Sha256: f8f868a61203c0c32c24582809dfe692901da845dc9fd69ef40fcb44d7bd653e
Contents?: true
Size: 736 Bytes
Versions: 1
Compression:
Stored size: 736 Bytes
Contents
class <%= class_name %> < ApplicationRecord has_secure_password :password has_secure_token :session_token validates :email, presence: true, uniqueness: true validates :email, format: { with: /\A[^@\s]+@[^@\s]+\z/ } validates_length_of :password, minimum: 8, allow_blank: true encrypts :session_token, deterministic: true before_validation do self.email = email.downcase.strip end after_update_commit do if self.email_previously_changed? EmailMailer.with(change: self.email_previous_change).changed.deliver_later end end after_update_commit do if self.password_digest_previously_changed? PasswordMailer.with(<%= singular_table_name %>: self).changed.deliver_later end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authentication-zero-0.0.21 | lib/generators/authentication/templates/models/resource.rb.tt |