Sha256: 98c9c7e0db0cf6d27122fa971bd620fbf4ec64555d03cb36ca0a744d40a8a3f1
Contents?: true
Size: 967 Bytes
Versions: 2
Compression:
Stored size: 967 Bytes
Contents
require 'active_support/concern' module ActiverecordMysqlSqlCache module Patches module ActiveRecord module Relation extend ActiveSupport::Concern def mysql_sql_cache_value=(value) @values[:mysql_sql_cache] = value end def mysql_sql_cache_value @values[:mysql_sql_cache] end def sql_cache(enabled=true) if enabled.nil? self.mysql_sql_cache_value = nil else self.mysql_sql_cache_value = enabled ? ' SQL_CACHE ' : ' SQL_NO_CACHE ' end self end def sql_no_cache sql_cache(false) end included do def build_arel_with_sql_cache build_arel_without_sql_cache.tap do |arel| arel.mysql_sql_cache = self.mysql_sql_cache_value end end alias_method_chain :build_arel, :sql_cache end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems