Sha256: 57f061434ac6ff3f37aa88baccc90341d4f825f0ddb6aed4eb0b159350e0c2e1
Contents?: true
Size: 829 Bytes
Versions: 2
Compression:
Stored size: 829 Bytes
Contents
module Mocks module CacheQuery if Torque::PostgreSQL::AR720 def get_last_executed_query(&block) cache = ActiveRecord::Base.connection.query_cache cache.instance_variable_set(:@enabled, true) map = cache.instance_variable_get(:@map) block.call result = map.keys.first cache.instance_variable_set(:@enabled, false) map.delete(result) result end else def get_last_executed_query(&block) conn = ActiveRecord::Base.connection conn.instance_variable_set(:@query_cache_enabled, true) block.call result = conn.query_cache.keys.first conn.instance_variable_set(:@query_cache_enabled, false) conn.instance_variable_get(:@query_cache).delete(result) result end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
torque-postgresql-3.4.1 | spec/mocks/cache_query.rb |
torque-postgresql-3.4.0 | spec/mocks/cache_query.rb |