Sha256: 18ab48dd66b65e26e5aa399dbf908ba4168162d563b0fda1b005fd8af871aba1

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 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.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

2 entries across 2 versions & 1 rubygems

Version Path
kredis-0.1.1 lib/kredis/railtie.rb
kredis-0.1.0 lib/kredis/railtie.rb