diff options
author | José Valim <jose.valim@gmail.com> | 2012-04-29 10:13:56 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-04-29 10:13:56 -0700 |
commit | 82029c7511939074c7f50a415016fb2910c5d95e (patch) | |
tree | 03db4598fe7674dfc09cfb0893a80e583653fc1c /activerecord | |
parent | 8c2cf1ad1bbb63cab4b503724465d70154f6aab0 (diff) | |
parent | d3ccdf6505a9cb11d391698ebbdc523e0fffe824 (diff) | |
download | rails-82029c7511939074c7f50a415016fb2910c5d95e.tar.gz rails-82029c7511939074c7f50a415016fb2910c5d95e.tar.bz2 rails-82029c7511939074c7f50a415016fb2910c5d95e.zip |
Merge pull request #6056 from jeremyf/remove-deprecation-warning-due-to-reload
Removed deprecation warning for #find as a result of AR::Base#reload
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 8 |
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') |