lib/jbuilder/railtie.rb in jbuilder-2.4.1 vs lib/jbuilder/railtie.rb in jbuilder-2.5.0

- old
+ new

@@ -7,14 +7,21 @@ ActiveSupport.on_load :action_view do ActionView::Template.register_template_handler :jbuilder, JbuilderHandler require 'jbuilder/dependency_tracker' end - if app.config.respond_to?(:api_only) && app.config.api_only + if Rails::VERSION::MAJOR >= 5 + module ::ActionController + module ApiRendering + include ActionView::Rendering + end + end + ActiveSupport.on_load :action_controller do - include ActionView::Rendering - include ActionController::Helpers - include ActionController::ImplicitRender + if self == ActionController::API + include ActionController::Helpers + include ActionController::ImplicitRender + end end end end if Rails::VERSION::MAJOR >= 4