Sha256: 7eefed7553198781a2f7019b468a8b6ad840c6b2d6da72ef96ffcb6cd6560d64

Contents?: true

Size: 662 Bytes

Versions: 5

Compression:

Stored size: 662 Bytes

Contents

# frozen_string_literal: true

require 'active_record'

module OmniAuth
  module Identity
    module Models
      class ActiveRecord < ::ActiveRecord::Base
        include OmniAuth::Identity::Model
        include OmniAuth::Identity::SecurePassword

        self.abstract_class = true
        has_secure_password

        def self.auth_key=(key)
          super
          validates_uniqueness_of key, case_sensitive: false
        end

        def self.locate(search_hash)
          search_hash = search_hash.reverse_merge!('provider' => 'identity') if column_names.include?('provider')
          where(search_hash).first
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
omniauth-identity-3.0.6 lib/omniauth/identity/models/active_record.rb
omniauth-identity-3.0.5 lib/omniauth/identity/models/active_record.rb
omniauth-identity-3.0.4 lib/omniauth/identity/models/active_record.rb
omniauth-identity-3.0.3 lib/omniauth/identity/models/active_record.rb
omniauth-identity-3.0.2 lib/omniauth/identity/models/active_record.rb