Sha256: 8ffe8e3a9a05a2c9f00176a3182407cd6a9e4c816f8386af14fe893409da6859
Contents?: true
Size: 725 Bytes
Versions: 2
Compression:
Stored size: 725 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 before_validation if: :email_changed? do self.verified = false end after_create_commit do IdentityMailer.with(<%= singular_table_name %>: self).email_verify_confirmation.deliver_later end after_update_commit if: :email_previously_changed? do IdentityMailer.with(<%= singular_table_name %>: self).email_verify_confirmation.deliver_later end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
authentication-zero-2.2.8 | lib/generators/authentication/templates/models/model.rb.tt |
authentication-zero-2.2.7 | lib/generators/authentication/templates/models/model.rb.tt |