Sha256: 31f794a48d13fec6cf478ef8d09155f06353d402e13fa8e3c4a1ec856f487624

Contents?: true

Size: 1018 Bytes

Versions: 4

Compression:

Stored size: 1018 Bytes

Contents

# frozen_string_literal: true

module Jb
  class Railtie < ::Rails::Railtie
    initializer 'jb' do
      ActiveSupport.on_load :action_view do
        if Rails::VERSION::MAJOR >= 6
          require 'jb/action_view_monkeys'
        else
          require 'jb/action_view_legacy_monkeys'
        end
        require 'jb/handler'
        ::ActionView::Template.register_template_handler :jb, Jb::Handler
      end
    end

    if Rails::VERSION::MAJOR >= 5
      module ::ActionController
        module ApiRendering
          include ActionView::Rendering
        end
      end

      ActiveSupport.on_load :action_controller do
        if self == ActionController::API
          include ActionController::Helpers
          include ActionController::ImplicitRender
        end
      end
    end

    generators do |app|
      Rails::Generators.configure! app.config.generators
      Rails::Generators.hidden_namespaces.uniq!
      require_relative '../generators/rails/scaffold_controller_generator'
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
jb-0.8.2 lib/jb/railtie.rb
jb-0.8.1 lib/jb/railtie.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/jb-0.8.0/lib/jb/railtie.rb
jb-0.8.0 lib/jb/railtie.rb