Permalink
Browse files

Merge pull request #6056 from jeremyf/remove-deprecation-warning-due-…

…to-reload

Removed deprecation warning for #find as a result of AR::Base#reload
  • Loading branch information...
2 parents 8c2cf1a + d3ccdf6 commit 82029c7511939074c7f50a415016fb2910c5d95e @josevalim josevalim committed Apr 29, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 activerecord/lib/active_record/persistence.rb
@@ -268,7 +268,13 @@ def reload(options = nil)
clear_aggregation_cache
clear_association_cache
- fresh_object = self.class.unscoped { self.class.find(id, options) }
+ fresh_object =
+ if options.present? && options[:lock]
+ self.class.unscoped { self.class.lock.find(id) }
+ else
+ self.class.unscoped { self.class.find(id) }
+ end
+
@attributes.update(fresh_object.instance_variable_get('@attributes'))
@columns_hash = fresh_object.instance_variable_get('@columns_hash')

0 comments on commit 82029c7

Please sign in to comment.