Module: AuthAssistant::RoleStrategy::RoleAssignment::ClassMethods

Defined in:
lib/auth_assistant/role_strategies/role_assignment.rb

Instance Method Summary collapse

Instance Method Details

#set_relationshipsObject



26
27
28
# File 'lib/auth_assistant/role_strategies/role_assignment.rb', line 26

def set_relationships
  has_many :roles
end

#set_scopeObject



19
20
21
22
23
24
# File 'lib/auth_assistant/role_strategies/role_assignment.rb', line 19

def set_scope
  scope :with_role, lambda { |role| 
    joins(:roles).
    where("user.roles_id = roles.id AND roles.id == ?", role)
  }
end