Sha256: cf4378d1bb44e92d2c5c3862a8d7bc1bddcda2db2535af6e2d68ff9c6ffcfe3d

Contents?: true

Size: 1.11 KB

Versions: 9

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

module PaperTrail
  # Represents code to load within Rails framework. See documentation in
  # `railties/lib/rails/railtie.rb`.
  # @api private
  class Railtie < ::Rails::Railtie
    # PaperTrail only has one initializer.
    #
    # We specify `before: "load_config_initializers"` to ensure that the PT
    # initializer happens before "app initializers" (those defined in
    # the app's `config/initalizers`).
    initializer "paper_trail", before: "load_config_initializers" do
      # `on_load` is a "lazy load hook". It "declares a block that will be
      # executed when a Rails component is fully loaded". (See
      # `active_support/lazy_load_hooks.rb`)
      ActiveSupport.on_load(:action_controller) do
        require "paper_trail/frameworks/rails/controller"

        # Mix our extensions into `ActionController::Base`, which is `self`
        # because of the `class_eval` in `lazy_load_hooks.rb`.
        include PaperTrail::Rails::Controller
      end

      ActiveSupport.on_load(:active_record) do
        require "paper_trail/frameworks/active_record"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/paper_trail-12.3.0/lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-15.1.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-15.0.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-14.0.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-13.0.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-12.3.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-12.2.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-12.1.0 lib/paper_trail/frameworks/rails/railtie.rb
paper_trail-12.0.0 lib/paper_trail/frameworks/rails/railtie.rb