Module: AuthAssistant::RoleStrategy::MultiRoleAssignment::ClassMethods
- Defined in:
- lib/auth_assistant/role_strategies/multi_role_assignment.rb
Instance Method Summary collapse
Instance Method Details
#set_relationships ⇒ Object
18 19 20 21 |
# File 'lib/auth_assistant/role_strategies/multi_role_assignment.rb', line 18 def set_relationships has_many :role_assignments has_many :roles, :through => :role_assignments end |
#set_scope ⇒ Object
11 12 13 14 15 16 |
# File 'lib/auth_assistant/role_strategies/multi_role_assignment.rb', line 11 def set_scope scope :with_role, lambda { |role| joins(:roles, :role_assignments). where("role_assigments.user_id == id AND role_assigments.role_id == role.id AND roles.id == ?", role) } end |