Sha256: a582a9733694dd5e86e63f0d7b8b029169c595a7cc96c7e0a0918afca96def33

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

require 'dm-core'
require 'dm-validations'

module OmniAuth
  module Identity
    module Models
      module DataMapper
        def self.included(base)
          base.class_eval do
            include OmniAuth::Identity::Model
            include OmniAuth::Identity::SecurePassword

            # http://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-persisted-3F
            # http://rubydoc.info/github/mongoid/mongoid/master/Mongoid/State#persisted%3F-instance_method
            alias persisted? valid?

            has_secure_password

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

            def self.locate(search_hash)
              all(search_hash).first
            end
          end
        end
      end # DataMapper
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
omniauth-identity-2.0.0 lib/omniauth/identity/models/data_mapper.rb
omniauth-identity2-2.0 lib/omniauth/identity/models/data_mapper.rb
omniauth-identity-1.1.1 lib/omniauth/identity/models/data_mapper.rb