Sha256: c1a0732ba9044504f4c8b3c985e98906ee3486612a7b13643d5bb28b21bb4f44
Contents?: true
Size: 687 Bytes
Versions: 1
Compression:
Stored size: 687 Bytes
Contents
class <%= class_name %> < ApplicationRecord has_secure_password has_many :sessions, dependent: :destroy validates :email, presence: true, uniqueness: true validates :email, format: { with: /\A[^@\s]+@[^@\s]+\z/ } validates_length_of :password, minimum: 8, allow_blank: 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-2.0.0 | lib/generators/authentication/templates/models/model.rb.tt |