Skip to content

Commit

Permalink
No more use of BSON OrderedHash, merge into normal Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Apr 11, 2010
1 parent d53911b commit df591a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Use `bundle install` in order to install these gems
# Use `bundle exec rake` in order to run the specs using the bundle
source "http://gemcutter.org"

gem "activemodel", ">= 3.0.beta2", :git => "git://github.com/rails/rails.git"
gem "activemodel", ">= 3.0.beta2"
gem "will_paginate", ">= 3.0.pre"
gem "mongo", "0.20.1"
gem "bson", "0.20.1"
gem "bson_ext", "0.20.1"

gem "rspec", "1.3.0"
gem "mocha", "0.9.8"

gem "ruby-debug"
6 changes: 3 additions & 3 deletions lib/mongoid/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ module InstanceMethods
# all attributes excluding timestamps on the object.
def ==(other)
return false unless other.is_a?(Document)
attributes.except(:modified_at).except(:created_at) ==
other.attributes.except(:modified_at).except(:created_at)
raw_attributes.except(:modified_at).except(:created_at) ==
other.raw_attributes.except(:modified_at).except(:created_at)
end

# Delegates to ==
Expand Down Expand Up @@ -188,7 +188,7 @@ def raw_attributes

# Reloads the +Document+ attributes from the database.
def reload
@attributes = collection.find_one(:_id => id)
@attributes = {}.merge(collection.find_one(:_id => id))
self.associations.each { |association_name, association| unmemoize(association_name) }; self
end

Expand Down
3 changes: 2 additions & 1 deletion lib/mongoid/factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class Factory #:nodoc:
#
# klass: The class to instantiate from if _type is not present.
# attributes: The +Document+ attributes.
def self.build(klass, attrs)
def self.build(klass, attributes)
attrs = {}.merge(attributes)
type = attrs["_type"]
type ? type.constantize.instantiate(attrs) : klass.instantiate(attrs)
end
Expand Down

0 comments on commit df591a9

Please sign in to comment.