Sha256: 3e6f10862f1b45115f5fcd5f7bd7b996cb37996be1e9fa27410754d34f25a0ef

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

require "rails/railtie"

module Kredis
  class Railtie < ::Rails::Railtie
    config.kredis = ActiveSupport::OrderedOptions.new
    config.eager_load_namespaces << Kredis

    initializer "kredis.testing" do
      ActiveSupport.on_load(:active_support_test_case) do
        parallelize_setup    { |worker| Kredis.namespace = "test-#{worker}" }
        parallelize_teardown { Kredis.clear_all }
      end
    end

    initializer "kredis.logger" do
      Kredis.logger = Rails.logger
    end

    initializer "kredis.configurator" do
      Kredis.configurator = Rails.application
    end

    initializer "kredis.attributes" do
      ActiveSupport.on_load(:active_model) do
        ActiveModel::Base.send :include, Kredis::Attributes
      end

      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Base.send :include, Kredis::Attributes
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kredis-0.1.2 lib/kredis/railtie.rb