OSDN Git Service

90958af695845c20a37338c588142b955b788020
[pettanr/pettanr.git] / app / models / user.rb
1 class User < ActiveRecord::Base
2   has_one :author
3   
4   # Include default devise modules. Others available are:
5   # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
6   devise :database_authenticatable, :registerable,
7          :recoverable, :rememberable, :trackable, :token_authenticatable, :validatable#, :confirmable
8
9   # Setup accessible (or protected) attributes for your model
10   attr_accessible :id, :name, :password, :password_confirmation, :remember_me , :email
11
12   def create_token
13     self.ensure_authentication_token
14     self.save
15   end
16   
17   def delete_token
18     self.authentication_token = nil
19     self.save
20   end
21   
22 end