Module: Wheels::ActiveRecordUserExtensions

Defined in:
lib/wheels/active_record_user_extensions.rb

Instance Method Summary collapse

Instance Method Details

#confirm!Object



20
21
22
23
# File 'lib/wheels/active_record_user_extensions.rb', line 20

def confirm!
  self.confirmed_at = DateTime::now
  save
end

#create_profileObject



3
4
5
# File 'lib/wheels/active_record_user_extensions.rb', line 3

def create_profile
  self.profile ||= Profile.create(:user => self)
end

#role=(role) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/wheels/active_record_user_extensions.rb', line 7

def role=(role)
  if role.kind_of? Role
    self.role_id = role.id
  else
    role = role.to_s.camelize
    if role.is_numeric?
      self.role_id= role
    else
      self.role_id= Role.find_by_name(role).id
    end
  end
end