Sha256: 6c5d68fe49d74804610b646bb576bdcc4d92d5677bd5e0a0ec6cbc0d45f76ab9

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

require 'couch_potato'

module OmniAuth
  module Identity
    module Models
      # can not be named CouchPotato since there is a class with that name
      # NOTE: CouchPotato is based on ActiveModel.
      module CouchPotatoModule
        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

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-3.0.6 lib/omniauth/identity/models/couch_potato.rb
omniauth-identity-3.0.5 lib/omniauth/identity/models/couch_potato.rb