diff --git a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb index e6b8e3a..b192c46 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -44,6 +44,9 @@ module ActiveRecord @query_cache_enabled = old end + # Clear the query cache. One reason you may wish to call this method explicitly is between queries that ask + # the database to randomize results. Otherwise the cache would see the same SQL query and repeatedly return + # the same result each time, silently undermining the randomness you were expecting. def clear_query_cache @query_cache.clear if @query_cache end