lib/superstore/persistence.rb in superstore-2.0.1 vs lib/superstore/persistence.rb in superstore-2.1.0
- old
+ new
@@ -41,10 +41,11 @@
allocate.tap do |object|
object.instance_variable_set("@id", id) if id
object.instance_variable_set("@new_record", false)
object.instance_variable_set("@destroyed", false)
object.instance_variable_set("@attributes", typecast_persisted_attributes(attributes))
+ object.instance_variable_set("@association_cache", {})
end
end
def encode_attributes(attributes)
encoded = {}
@@ -125,10 +126,10 @@
became.instance_variable_set("@destroyed", destroyed?)
became
end
def reload
- clear_associations_cache
+ clear_association_cache
@attributes = self.class.find(id).instance_variable_get('@attributes')
self
end
private