Sha256: 402433f6303b02f3dd9fd333b018cf231bbda0174692ef82bdf39e737695f4db

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 Bytes

Contents

require 'rails'
require 'rails/observers/version'

module Rails
  module Observers
    class Railtie < ::Rails::Railtie
      initializer "active_record.observer", :before => "active_record.set_configs" do
        ActiveSupport.on_load(:active_record) do
          require "rails/observers/activerecord/active_record"
        end
      end

      initializer "action_controller.caching.sweppers" do
        ActiveSupport.on_load(:action_controller) do
          require "rails/observers/action_controller/caching"
        end
      end

      config.after_initialize do |app|
        ActiveSupport.on_load(:active_record) do
          ActiveRecord::Base.instantiate_observers

          ActionDispatch::Reloader.to_prepare do
            ActiveRecord::Base.instantiate_observers
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-observers-0.1.0 lib/rails-observers.rb