Module: AuthAssistant::RoleStrategy::RoleField
- Defined in:
- lib/auth_assistant/role_strategies/role_field.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
26 27 28 |
# File 'lib/auth_assistant/role_strategies/role_field.rb', line 26 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#role?(_role) ⇒ Boolean
14 15 16 |
# File 'lib/auth_assistant/role_strategies/role_field.rb', line 14 def role?(_role) roles.include? _role end |
#roles ⇒ Object
10 11 12 |
# File 'lib/auth_assistant/role_strategies/role_field.rb', line 10 def roles [role] end |
#roles=(*roles) ⇒ Object
5 6 7 8 |
# File 'lib/auth_assistant/role_strategies/role_field.rb', line 5 def roles=(*roles) new_role = roles.first.to_s self.role = new_role if CanCan.available_roles.include? new_role end |