lib/toy/reloadable.rb in toystore-0.13.0 vs lib/toy/reloadable.rb in toystore-0.13.1
- old
+ new
@@ -1,18 +1,18 @@
module Toy
module Reloadable
extend ActiveSupport::Concern
def reload
- if attrs = adapter.read(id)
- attrs['id'] = id
+ if attrs = adapter.read(persisted_id)
+ attrs['id'] = persisted_id
instance_variables.each { |ivar| instance_variable_set(ivar, nil) }
initialize_attributes
send(:attributes=, attrs, new_record?)
self.class.lists.each_key { |name| send(name).reset }
self.class.references.each_key { |name| send("reset_#{name}") }
else
- raise NotFound.new(id)
+ raise NotFound.new(persisted_id)
end
self
end
end
end