Sha256: fd6635b1c7ae3dfcfe4bab78d8d6efd1712ca6f8d1d4f196935cac033ebfd92c
Contents?: true
Size: 590 Bytes
Versions: 9
Compression:
Stored size: 590 Bytes
Contents
class User < ActiveRecord::Base has_secure_password({ validations: false }) before_save :create_remember_token validates :name, presence: true, length: { maximum: 15 }, uniqueness: { case_sensitive: false } validates :password, presence: true, length: { minimum: 5 }, confirmation: true, :unless => lambda { |v| v.validate_password? } validates :level, presence: true def validate_password? password.blank? && password_confirmation.blank? && !self.new_record? end private def create_remember_token self.remember_token = SecureRandom.urlsafe_base64 end end
Version data entries
9 entries across 9 versions & 1 rubygems