Sha256: 5a5250adef511856bd691bcc9ada635f38bc414be59b00053002432c01d3995f
Contents?: true
Size: 937 Bytes
Versions: 5
Compression:
Stored size: 937 Bytes
Contents
# rails g model Authentication user_id:integer provider:string uid:string # rails g migration CreateUsers first_name:string last_name:string class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :encryptable, :confirmable, :lockable and :omniauthable devise :database_authenticatable, :registerable, :timeoutable, :recoverable, :rememberable, :trackable, :validatable # # Setup accessible (or protected) attributes for your model # attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name # Named Scopes scope :current, -> { where(deleted: false) } def name "#{first_name} #{last_name}" end def reverse_name "#{last_name}, #{first_name}" end # Overriding Devise built-in active? method def active_for_authentication? super and self.status == 'active' and not self.deleted? end end
Version data entries
5 entries across 5 versions & 1 rubygems