From 95bdb95ad5e311a215535056851682840f96c1b7 Mon Sep 17 00:00:00 2001 From: Shane Hender Date: Fri, 24 Apr 2015 13:29:33 +0100 Subject: Cause ActiveRecord::Base::reload to also ignore the QueryCache. --- activerecord/lib/active_record/persistence.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index ae1c326d95..689c170127 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -380,7 +380,7 @@ module ActiveRecord # # => # # # Attributes are reloaded from the database, and caches busted, in - # particular the associations cache. + # particular the associations cache and the QueryCache. # # If the record no longer exists in the database ActiveRecord::RecordNotFound # is raised. Otherwise, in addition to the in-place modification the method @@ -416,6 +416,8 @@ module ActiveRecord # end # def reload(options = nil) + self.class.connection.clear_query_cache + fresh_object = if options && options[:lock] self.class.unscoped { self.class.lock(options[:lock]).find(id) } -- cgit v1.2.3