-
Notifications
You must be signed in to change notification settings - Fork 406
/
user.rb
29 lines (21 loc) · 879 Bytes
/
user.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class User < ActiveRecord::Base
has_many :activities
before_save :ensure_authentication_token
before_save :ensure_gravatar_hash
# Kandan.devise_modules is defined in config/initializers/kandan.rb
devise devise *Kandan.devise_modules
# Setup accessible (or protected) attributes for your model
attr_accessible :id, :username, :email, :password, :password_confirmation, :remember_me, :first_name, :last_name, :locale, :gravatar_hash
def cloudfuji_extra_attributes(extra_attributes)
self.first_name = extra_attributes["first_name"].to_s
self.last_name = extra_attributes["last_name"].to_s
self.email = extra_attributes["email"]
self.locale = extra_attributes["locale"]
end
def ensure_gravatar_hash
self.gravatar_hash = Digest::MD5.hexdigest self.email
end
def active_for_authentication?
super && active?
end
end