Class: Locomotive::Membership

Inherits:
Object
  • Object
show all
Includes:
Locomotive::Mongoid::Document
Defined in:
app/models/locomotive/membership.rb

Constant Summary collapse

ROLES =
%w(visitor author designer admin)

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject

virtual attributes ##


20
21
22
# File 'app/models/locomotive/membership.rb', line 20

def email
  @email
end

Instance Method Details

#_roleObject

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

#accountObject

validations ##


12
# File 'app/models/locomotive/membership.rb', line 12

belongs_to  :account, class_name: 'Locomotive::Account', validate: false

#roleObject

fields ##


9
# File 'app/models/locomotive/membership.rb', line 9

field :role, default: 'author'

#to_roleObject


33
34
35
# File 'app/models/locomotive/membership.rb', line 33

def to_role
  self.role.to_sym
end