aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorJeremy Friesen <jeremy.n.friesen@gmail.com>2012-04-29 13:10:43 -0400
committerJeremy Friesen <jeremy.n.friesen@gmail.com>2012-04-29 13:10:43 -0400
commitd3ccdf6505a9cb11d391698ebbdc523e0fffe824 (patch)
treea8107410260d59f058ac3436cd07b82ce50c5b42 /activerecord/lib/active_record/persistence.rb
parent6bea191a750db805aefa82339074fe61637e8fb1 (diff)
downloadrails-d3ccdf6505a9cb11d391698ebbdc523e0fffe824.tar.gz
rails-d3ccdf6505a9cb11d391698ebbdc523e0fffe824.tar.bz2
rails-d3ccdf6505a9cb11d391698ebbdc523e0fffe824.zip
Removed deprecation warning for #find as a result of AR::Base#reload
Cleaned up "DEPRECATION WARNING: Passing options to #find is deprecated. Please build a scope and then call #find on it."
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 12e232a97f..d6ffa1a9f7 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -268,7 +268,13 @@ module ActiveRecord
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')