Sha256: 51235bdcc976f0ac7110c7813c3359b4e39d8b0cbeb4883cd5a30ec591bca2f0

Contents?: true

Size: 852 Bytes

Versions: 1

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

require 'active_record'

module OmniAuth
  module Identity
    module Models
      # ActiveRecord is an ORM for MySQL, PostgreSQL, and SQLite3:
      #   https://guides.rubyonrails.org/active_record_basics.html
      # NOTE: ActiveRecord is based on ActiveModel.
      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

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-identity-3.0.9 lib/omniauth/identity/models/active_record.rb