Module: Authlogic::ActsAsAuthentic::PerishableToken::Methods

Defined in:
lib/authlogic/acts_as_authentic/perishable_token.rb

Overview

All methods relating to the perishable token.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/authlogic/acts_as_authentic/perishable_token.rb', line 54

def self.included(klass)
  return unless klass.column_names.include?("perishable_token")

  klass.class_eval do
    extend ClassMethods
    include InstanceMethods

    validates_uniqueness_of :perishable_token, case_sensitive: true,
                                               if: :will_save_change_to_perishable_token?
    before_save :reset_perishable_token, unless: :disable_perishable_token_maintenance?
  end
end