1 class Admin < ActiveRecord::Base
2 # Include default devise modules. Others available are:
3 # , :encryptable, :lockable, :timeoutable and :omniauthable, :confirmable
4 devise :database_authenticatable, :registerable,
5 :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable
7 # Setup accessible (or protected) attributes for your model
8 attr_accessible :email, :password, :password_confirmation, :remember_me
9 before_save :ensure_authentication_token
\r
11 def active_for_authentication?
\r
12 super && (self.approve == 1)
\r
15 def self.start(email, passwd)
16 a = Admin.create! :email => email, :password => passwd, :password_confirmation => passwd