mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
10 lines
343 B
Ruby
10 lines
343 B
Ruby
class EnterpriseRole < ActiveRecord::Base
|
|
belongs_to :user, :class_name => Spree.user_class
|
|
belongs_to :enterprise
|
|
|
|
validates_presence_of :user_id, :enterprise_id
|
|
validates_uniqueness_of :enterprise_id, scope: :user_id, message: "^That role is already present."
|
|
|
|
scope :by_user_email, joins(:user).order('spree_users.email ASC')
|
|
end
|