Method: Authlogic::ActsAsAuthentic::SingleAccessToken::Methods.included

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

.included(klass) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/authlogic/acts_as_authentic/single_access_token.rb', line 38

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

  klass.class_eval do
    include InstanceMethods
    validates_uniqueness_of :single_access_token,
      case_sensitive: true,
      if: :will_save_change_to_single_access_token?

    before_validation :reset_single_access_token, if: :reset_single_access_token?
    if respond_to?(:after_password_set)
      after_password_set(
        :reset_single_access_token,
        if: :change_single_access_token_with_password?
      )
    end
  end
end