Method: ActiveRecord::Base#reload
- Defined in:
- lib/active_record/base.rb
#reload(options = nil) ⇒ Object
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.
2748 2749 2750 2751 2752 2753 2754 |
# File 'lib/active_record/base.rb', line 2748 def reload( = nil) clear_aggregation_cache clear_association_cache @attributes.update(self.class.send(:with_exclusive_scope) { self.class.find(self.id, ) }.instance_variable_get('@attributes')) @attributes_cache = {} self end |