Class: Locomotive::Membership
- Inherits:
-
Object
- Object
- Locomotive::Membership
- Includes:
- Locomotive::Mongoid::Document
- Defined in:
- app/models/locomotive/membership.rb
Constant Summary collapse
- ROLES =
%w(visitor author designer admin)
Instance Attribute Summary collapse
-
#email ⇒ Object
virtual attributes ##.
Instance Method Summary collapse
-
#_role ⇒ Object
methods ##.
-
#account ⇒ Object
validations ##.
-
#role ⇒ Object
fields ##.
- #to_role ⇒ Object
Instance Attribute Details
#email ⇒ Object
virtual attributes ##
20 21 22 |
# File 'app/models/locomotive/membership.rb', line 20 def email @email end |
Instance Method Details
#_role ⇒ Object
methods ##
27 28 29 30 31 |
# File 'app/models/locomotive/membership.rb', line 27 ROLES.each do |_role| define_method("#{_role}?") do self.role == _role end end |
#account ⇒ Object
validations ##
12 |
# File 'app/models/locomotive/membership.rb', line 12 belongs_to :account, class_name: 'Locomotive::Account', validate: false |
#role ⇒ Object
fields ##
9 |
# File 'app/models/locomotive/membership.rb', line 9 field :role, default: 'author' |
#to_role ⇒ Object
33 34 35 |
# File 'app/models/locomotive/membership.rb', line 33 def to_role self.role.to_sym end |