Sha256: 05b917bf4a64709a878836888bf427d6abf0957806c61bec9879d65b432b45e9

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

require "rails/railtie"

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

    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 = config.kredis.logger || Rails.logger
    end

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

    initializer "kredis.attributes" do
      # TODO: Add run_load_hooks to ActiveModel::Model so this runs.
      ActiveSupport.on_load(:active_model) do
        include Kredis::Attributes
      end

      ActiveSupport.on_load(:active_record) do
        include Kredis::Attributes
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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