Class: Decidim::User
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Decidim::User
- Defined in:
- app/models/decidim/user.rb
Overview
A User is a citizen that wants to join the platform to participate.
Constant Summary collapse
- ROLES =
%w(admin moderator official).freeze
Instance Attribute Summary collapse
-
#invitation_instructions ⇒ Object
Public: Allows customizing the invitation instruction email content when inviting a user.
Instance Method Summary collapse
-
#ability ⇒ Object
Gets the ability instance for the given user.
-
#role?(role) ⇒ Boolean
Checks if the user has the given ‘role` or not.
Instance Attribute Details
#invitation_instructions ⇒ Object
Public: Allows customizing the invitation instruction email content when inviting a user.
Returns a String.
28 29 30 |
# File 'app/models/decidim/user.rb', line 28 def invitation_instructions @invitation_instructions end |
Instance Method Details
#ability ⇒ Object
Gets the ability instance for the given user.
33 34 35 |
# File 'app/models/decidim/user.rb', line 33 def ability @ability ||= Ability.new(self) end |
#role?(role) ⇒ Boolean
Checks if the user has the given ‘role` or not.
role - a String or a Symbol that represents the role that is being
checked
Returns a boolean.
43 44 45 |
# File 'app/models/decidim/user.rb', line 43 def role?(role) roles.include?(role.to_s) end |