Fixing problem with reloading models and dirty tracking
This commit is contained in:
parent
de1cab1271
commit
f5be6c7679
|
@ -87,7 +87,7 @@ module CouchRest
|
|||
#
|
||||
# Returns self.
|
||||
def reload
|
||||
merge!(self.class.get(id))
|
||||
prepare_all_attributes(database.get(id), :directly_set_attributes => true)
|
||||
self
|
||||
end
|
||||
|
||||
|
|
|
@ -241,6 +241,14 @@ describe "Dirty" do
|
|||
end
|
||||
end
|
||||
|
||||
it "should report changes if an array is popped after reload" do
|
||||
should_change_array do |array, obj|
|
||||
obj.reload
|
||||
obj.keywords.pop
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
it "should report no changes if an empty array is popped" do
|
||||
should_not_change_array do |array, obj|
|
||||
array.clear
|
||||
|
|
Loading…
Reference in a new issue