instance method
reload
Ruby on Rails 3.1.12
Since v3.0.20Signature
reload(options = nil)
Reloads the attributes of this object from the database. The optional options argument is passed to find when reloading so you may do e.g. record.reload(:lock => true) to reload the same record with an exclusive row lock.
Parameters
-
optionsopt = nil
Source
# File activerecord/lib/active_record/persistence.rb, line 233
def reload(options = nil)
clear_aggregation_cache
clear_association_cache
IdentityMap.without do
fresh_object = self.class.unscoped { self.class.find(self.id, options) }
@attributes.update(fresh_object.instance_variable_get('@attributes'))
end
@attributes_cache = {}
self
end
Defined in activerecord/lib/active_record/persistence.rb line 233
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Persistence