module AuthAssistant::RoleStrategy::MultiRoleAssignment::ClassMethods

Public Instance Methods

set_relationships() click to toggle source
# 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() click to toggle source
# 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