method
cache_sql
cache_sql(sql)
private
Hide source
# File activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb, line 61 def cache_sql(sql) result = if @query_cache.has_key?(sql) ActiveSupport::Notifications.instrument("sql.active_record", :sql => sql, :name => "CACHE", :connection_id => self.object_id) @query_cache[sql] else @query_cache[sql] = yield end if Array === result result.collect { |row| row.dup } else result.duplicable? ? result.dup : result end rescue TypeError result end