Module: Mongoid::Roles::Object

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid/roles/object.rb

Instance Method Summary collapse

Instance Method Details

#accepts_no_role!(role_name, subject) ⇒ Object

object.accepts_no_role!(role_name, subject). An alias for subject.has_no_role!(role_name, object).



17
18
19
# File 'lib/mongoid/roles/object.rb', line 17

def accepts_no_role!(role_name, subject)
  subject.has_no_role!(role_name, self)
end

#accepts_role!(role_name, subject) ⇒ Object

object.accepts_role!(role_name, subject). An alias for subject.has_role!(role_name, object).



12
13
14
# File 'lib/mongoid/roles/object.rb', line 12

def accepts_role!(role_name, subject)
  subject.has_role!(role_name, self)
end

#accepts_role?(role_name, subject) ⇒ Boolean

object.accepts_role?(role_name, subject). An alias for subject.has_role?(role_name, object).

Returns:

  • (Boolean)


7
8
9
# File 'lib/mongoid/roles/object.rb', line 7

def accepts_role?(role_name, subject)
  subject.has_role?(role_name, self)
end

#accepts_role_by?(subject) ⇒ Boolean

object.accepts_role_by?(subject). Same as accepts_roles_by?.

Returns:

  • (Boolean)


27
28
29
# File 'lib/mongoid/roles/object.rb', line 27

def accepts_role_by?(subject)
  accepts_roles_by?(subject)
end

#accepts_roles_by(subject) ⇒ Object

object.accepts_roles_by(subject). An alias for subject.roles_for(object).



32
33
34
# File 'lib/mongoid/roles/object.rb', line 32

def accepts_roles_by(subject)
  subject.roles_for(self)
end

#accepts_roles_by?(subject) ⇒ Boolean

object.accepts_roles_by?(subject). An alias for subject.has_roles_for?(object).

Returns:

  • (Boolean)


22
23
24
# File 'lib/mongoid/roles/object.rb', line 22

def accepts_roles_by?(subject)
  subject.has_roles_for?(self)
end