Sha256: 3474835ebf0f0534f962a56fd8e6b23aa6ed917d7cb3e13350013ffc68f893b8

Contents?: true

Size: 703 Bytes

Versions: 15

Compression:

Stored size: 703 Bytes

Contents

module Shim
  extend ::ActiveSupport::Concern

  included do
    include ::Mongoid::Timestamps
    field :created_at, :type => DateTime
  end

  module ClassMethods
    def last(options={})
      options.delete(:order) if options[:order] == "id"
      super(options)
    end

    def find_by_email(email)
      first(:conditions => { :email => email })
    end
  end

  # overwrite equality (because some devise tests use this for asserting model equality)
  def ==(other)
    other.is_a?(self.class) && _id == other._id
  end

  # Mongoid does not have this method in the current beta version (2.0.0.beta.20)
  def update_attribute(attribute, value)
    update_attributes(attribute => value)
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
devise_sociable-0.1.0 vendor/bundle/gems/devise-1.2.1/test/rails_app/app/mongoid/shim.rb
devise-1.4.2 test/rails_app/app/mongoid/shim.rb
devise-1.4.1 test/rails_app/app/mongoid/shim.rb
devise-1.3.4 test/rails_app/app/mongoid/shim.rb
devise-1.3.3 test/rails_app/app/mongoid/shim.rb
devise-1.3.2 test/rails_app/app/mongoid/shim.rb
devise-1.3.1 test/rails_app/app/mongoid/shim.rb
devise-1.3.0 test/rails_app/app/mongoid/shim.rb
devise-1.2.1 test/rails_app/app/mongoid/shim.rb
devise-1.2.0 test/rails_app/app/mongoid/shim.rb
devise-jdguyot-1.2.rc3 test/rails_app/app/mongoid/shim.rb
devise-1.2.rc2 test/rails_app/app/mongoid/shim.rb
devise-jdguyot-1.2.rc2 test/rails_app/app/mongoid/shim.rb
devise-jdguyot-1.2.rc test/rails_app/app/mongoid/shim.rb
devise-1.2.rc test/rails_app/app/mongoid/shim.rb