Sha256: 6d1056c5a92b6c555f9d348942edead3f84033ba323edf032b505c551e53987f

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

require 'mongoid'

module OmniAuth
  module Identity
    module Models
      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(key)
              where(auth_key => key).first
            end

          end

        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
omniauth-identity-1.1.0 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-1.0.0 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-1.0.0.rc2 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-1.0.0.rc1 lib/omniauth/identity/models/mongoid.rb