Sha256: c748d613d7a8ca6f3c0f953c01622056fb4b0193ae8cbf7df2a754515e075d0a

Contents?: true

Size: 848 Bytes

Versions: 4

Compression:

Stored size: 848 Bytes

Contents

module ActiveRecord::Turntable
  class Railtie < Rails::Railtie
    rake_tasks do
      require 'active_record/turntable/active_record_ext/database_tasks'
      load "active_record/turntable/railties/databases.rake"
    end

    # rails loading hook
    ActiveSupport.on_load(:before_initialize) do
      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Base.send(:include, ActiveRecord::Turntable)
      end
    end

    # initialize
    initializer "turntable.initialize_clusters" do
      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Turntable::Config.load!
      end
    end

    # QueryCache Middleware for turntable shards
    initializer "turntable.insert_query_cache_middleware" do |app|
      app.middleware.insert_after ActiveRecord::QueryCache, ActiveRecord::Turntable::Rack::QueryCache
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord-turntable-2.1.0.rc2 lib/active_record/turntable/railtie.rb
activerecord-turntable-2.1.0.rc1 lib/active_record/turntable/railtie.rb
activerecord-turntable-2.1.0.beta2 lib/active_record/turntable/railtie.rb
activerecord-turntable-2.1.0.beta1 lib/active_record/turntable/railtie.rb