mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-27 21:06:49 +00:00
This construct was previously used in Spree to switch out the user class with a dummy class during certain tests. We don't use this any more, so it's just mess.
🔥
13 lines
395 B
Ruby
13 lines
395 B
Ruby
# frozen_string_literal: true
|
|
|
|
class EnterpriseRole < ApplicationRecord
|
|
belongs_to :user, class_name: "Spree::User"
|
|
belongs_to :enterprise
|
|
|
|
validates :user, :enterprise, presence: true
|
|
validates :enterprise_id,
|
|
uniqueness: { scope: :user_id, message: I18n.t(:enterprise_role_uniqueness_error) }
|
|
|
|
scope :by_user_email, -> { joins(:user).order('spree_users.email ASC') }
|
|
end
|