Sha256: b19c59861012103336b303efcbd6483c241cf1c0fc71ac02628658d758b7ce4f

Contents?: true

Size: 1.06 KB

Versions: 9

Compression:

Stored size: 1.06 KB

Contents

module Devise
  module QueryCustomizers
    module FindRecord
      class << self
        def active_record
          %q{where(attributes).where(["username = :value OR email = :value", { :value => login }]).first}
        end

        def mongoid
          %q{where("function() {return this.username == '#{login}' || this.email == '#{login}'}").first}
        end  

        def mongo_mapper
          %q{where("function() {return this.username == '#{login}' || this.email == '#{login}'}").first}
        end  
      end
    end 
    
    module UserAuth
      class << self
        def active_record
          %q{
  # protected

  def self.find_for_database_authentication(conditions)
    login = conditions.delete(:login)
    where(conditions).where(["username = :value OR email = :value", { :value => login }]).first
  end
}
        end

        def mongoid
        %q{
  def self.find_for_database_authentication(conditions)
    login = conditions.delete(:login)
    self.any_of({ :username => value }, { :email => login }).first
  end
}
        end
      end
    end    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cream-0.9.2 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.9.1 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.9.0 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.8.9.3 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.8.9.2 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.8.9.1 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.8.9 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.8.8 lib/generators/devise/customize/helpers/query_customizers.rb
cream-0.8.7 lib/generators/devise/customize/helpers/query_customizers.rb