Sha256: b6f8230f8ca8a8c25ea9193785358532fd460607a2728d4edd4d42bc52e93f70
Contents?: true
Size: 1.16 KB
Versions: 10
Compression:
Stored size: 1.16 KB
Contents
class User < ActiveRecord::Base include ActiveModel::Validations attr_accessor :password_validator has_roles include ErpTechSvcs::Utils::CompassAccessNegotiator belongs_to :party attr_accessible :email, :password, :password_confirmation authenticates_with_sorcery! #password validations validates_confirmation_of :password, :message => "should match confirmation", :if => :password validates :password, :presence => true, :password_strength => true, :if => :password #email validations validates :email, :presence => {:message => 'Email cannot be blank'}, :uniqueness => true validates_format_of :email, :with => /\b[A-Z0-9._%a-z\-]+@(?:[A-Z0-9a-z\-]+\.)+[A-Za-z]{2,4}\z/ #username validations validates :username, :presence => {:message => 'Username cannot be blank'}, :uniqueness => true #these two methods allow us to assign instance level attributes that are not persisted. These are used for mailers def instance_attributes @instance_attrs.nil? ? {} : @instance_attrs end def add_instance_attribute(k,v) @instance_attrs = {} if @instance_attrs.nil? @instance_attrs[k] = v end end
Version data entries
10 entries across 10 versions & 1 rubygems