Sha256: f7177e239fcbbec490c682c03919bfdad373c686c099971ba3b64ef67d50f38d

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 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

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-3.0.8 lib/omniauth/identity/models/active_record.rb
omniauth-identity-3.0.7 lib/omniauth/identity/models/active_record.rb