Skip to content

Commit 64c510e

Browse files
Jorge Bejar and Santiago Pastorinospastorino
authored andcommitted
Fixes #317. AV::Rendering module should be included after AC::ApiRendering
1 parent 26b32cc commit 64c510e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/jbuilder/railtie.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ class Railtie < ::Rails::Railtie
99
require 'jbuilder/dependency_tracker'
1010
end
1111

12-
if app.config.respond_to?(:api_only) && app.config.api_only
12+
if Rails::VERSION::MAJOR >= 5
1313
module ::ActionController
1414
module ApiRendering
1515
include ActionView::Rendering
1616
end
1717
end
1818

1919
ActiveSupport.on_load :action_controller do
20-
include ActionController::Helpers
21-
include ActionController::ImplicitRender
20+
if self == ActionController::API
21+
include ActionController::Helpers
22+
include ActionController::ImplicitRender
23+
end
2224
end
2325
end
2426
end

0 commit comments

Comments
 (0)