Sha256: bdf79d0c5e83971bf27e6825e8d199d92e4d2790e13debc5c0084cbf8ffcd2c8

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

require 'mongoid'

module OmniAuth
  module Identity
    module Models
      # Mongoid is an ORM adapter for MongoDB:
      #   https://github.com/mongodb/mongoid
      # NOTE: Mongoid is based on ActiveModel.
      module Mongoid
        def self.included(base)
          base.class_eval do
            include ::OmniAuth::Identity::Model
            include ::OmniAuth::Identity::SecurePassword

            has_secure_password

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

            def self.locate(search_hash)
              where(search_hash).first
            end
          end
        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/mongoid.rb