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.
|
# Returns self.
|
||||||
def reload
|
def reload
|
||||||
merge!(self.class.get(id))
|
prepare_all_attributes(database.get(id), :directly_set_attributes => true)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,14 @@ describe "Dirty" do
|
||||||
end
|
end
|
||||||
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
|
it "should report no changes if an empty array is popped" do
|
||||||
should_not_change_array do |array, obj|
|
should_not_change_array do |array, obj|
|
||||||
array.clear
|
array.clear
|
||||||
|
|
Loading…
Reference in a new issue