Sha256: aa89bd15a3c4c36990779dd38651bcad7168d9cd25af0ec30d5b15ecd33d8c69

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

require 'active_record_multiple_query_cache/version'

module ActiveRecordMultipleQueryCache
  autoload :Base, 'active_record_multiple_query_cache/base'
  autoload :Rails4QueryCache, 'active_record_multiple_query_cache/rails4_query_cache'
  autoload :Rails5QueryCache, 'active_record_multiple_query_cache/rails5_query_cache'

  def self.install_query_cache(activerecord_base_class_name, rails = ::Rails)
    if rails.gem_version >= Gem::Version.new('5.0.0')
      require 'active_support/executor'
      executor = ActiveSupport::Executor
      hook = Rails5QueryCache.new(activerecord_base_class_name)

      executor.register_hook(hook)
    else
      middleware = Rails4QueryCache.new(activerecord_base_class_name)
      rails.configuration.app_middleware.insert_after('::ActionDispatch::Callbacks', middleware)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_record_multiple_query_cache-0.1.2 lib/active_record_multiple_query_cache.rb