Sha256: 7aa84bdcb478fca2a9b74aa420881548257969e73ff14d8ed0755c5c4ea28fec

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

require 'mongo_mapper'

module OmniAuth
  module Identity
    module Models
      module MongoMapper
        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

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-1.1.0 lib/omniauth/identity/models/mongo_mapper.rb
omniauth-identity-1.0.0 lib/omniauth/identity/models/mongo_mapper.rb