Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added reload to dirty and made sure it was clearing changes.

  • Loading branch information...
commit 7929b643cd18b396f083ffbb4ffc1ad6e58cdb78 1 parent 4110455
@jnunemaker jnunemaker authored
Showing with 6 additions and 6 deletions.
  1. +2 −2 lib/mongo_mapper/dirty.rb
  2. +4 −4 test/functional/test_dirty.rb
View
4 lib/mongo_mapper/dirty.rb
@@ -67,8 +67,8 @@ def save!(*args)
end
# <tt>reload</tt> the record and clears changed keys.
- # def reload_with_dirty(*args) #:nodoc:
- # record = reload_without_dirty(*args)
+ # def reload(*args) #:nodoc:
+ # record = super
# changed_keys.clear
# record
# end
View
8 test/functional/test_dirty.rb
@@ -54,15 +54,15 @@ def setup
should "not happen when loading from database" do
doc = @document.create(:phrase => 'Foo')
-
- doc = doc.reload
+ doc.phrase = 'Fart'
+ doc.changed?.should be_true
+ doc.reload
doc.changed?.should be_false
end
should "happen if changed after loading from database" do
doc = @document.create(:phrase => 'Foo')
-
- doc = doc.reload
+ doc.reload
doc.changed?.should be_false
doc.phrase = 'Bar'
doc.changed?.should be_true
Please sign in to comment.
Something went wrong with that request. Please try again.