diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2016-02-11 08:54:58 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2016-02-11 08:54:58 -0700 |
commit | 2a56b2d90d4fed8548e3a1e7a7b206454858c872 (patch) | |
tree | 47af48e0929ad7e145f112aa0433584f4e3bfdac /activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb | |
parent | 3a7a021ed936af50d436f419ac651203cfd072f6 (diff) | |
download | rails-2a56b2d90d4fed8548e3a1e7a7b206454858c872.tar.gz rails-2a56b2d90d4fed8548e3a1e7a7b206454858c872.tar.bz2 rails-2a56b2d90d4fed8548e3a1e7a7b206454858c872.zip |
Ensure prepared statement caching still occurs with Adequate Record
In Rails 5, we're much more restrictive about when we do or don't cache
a prepared statement. In particular, we never cache when we are sending
an IN statement or a SQL string literal
However, in the case of Adequate Record, we are *always* sending a raw
SQL string, and we *always* want to cache the result.
Fixes #23507
/cc @tgxworld
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 5e27cfe507..33dbab41cb 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb @@ -61,11 +61,11 @@ module ActiveRecord @query_cache.clear end - def select_all(arel, name = nil, binds = []) + def select_all(arel, name = nil, binds = [], preparable: nil) if @query_cache_enabled && !locked?(arel) arel, binds = binds_from_relation arel, binds sql = to_sql(arel, binds) - cache_sql(sql, binds) { super(sql, name, binds) } + cache_sql(sql, binds) { super(sql, name, binds, preparable: visitor.preparable) } else super end |