Module: PermitYo::Default::ModelExtensions::InstanceMethods
- Defined in:
- lib/permit_yo/default.rb
Instance Method Summary collapse
Instance Method Details
#accepts_role?(role, user) ⇒ Boolean
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/permit_yo/default.rb', line 33 def accepts_role?(role, user) if role == "self" self == user elsif self.respond_to? role self.send(role) == user elsif self.respond_to? role.pluralize self.send(role.pluralize).include?(user) else false end end |