Sha256: 7113a2fc74313ab6c35e0f242227c42509e889fdb72a97f984777ddb5bffa789
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 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 |app| # `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 if Gem::Version.new(::Rails::VERSION::STRING) >= Gem::Version.new("7.1") app.deprecators[:paper_trail] = PaperTrail.deprecator end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paper_trail-16.0.0 | lib/paper_trail/frameworks/rails/railtie.rb |
paper_trail-15.2.0 | lib/paper_trail/frameworks/rails/railtie.rb |