diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index d08e3c4e8e497b6395c6fe33fdd4eabcf8913bcc..0233937a251a62df401de44cdfe0c047a5b59bde 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -13,6 +13,7 @@ module ActionController autoload :Middleware autoload_under "metal" do + autoload :BasicRendering, 'action_controller/metal/rendering' autoload :Compatibility autoload :ConditionalGet autoload :Cookies diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 3fd5fb90d22f99d652ab2b0543d24e009e6bbfcc..9941c06201d9b3967273caec884d97caefbacb27 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -14,6 +14,7 @@ module ActionController # metal = Class.new(Metal) do include AbstractController::Rendering + include ActionController::BasicRendering end # Action Controllers are the core of a web request in \Rails. They are made up of one or more actions that are executed diff --git a/actionpack/lib/action_controller/metal/rendering.rb b/actionpack/lib/action_controller/metal/rendering.rb index abcc9d4acf2fb94c5e386a232f5ebab3339992b0..2d58e1440cb133c04c06efc8b277127dc4b82d32 100644 --- a/actionpack/lib/action_controller/metal/rendering.rb +++ b/actionpack/lib/action_controller/metal/rendering.rb @@ -1,4 +1,22 @@ module ActionController + module BasicRendering + extend ActiveSupport::Concern + + # Render template to response_body + # :api: public + def render(*args, &block) + super(*args, &block) + text = args.first[:text] + if text.present? + self.response_body = text + end + end + + def rendered_format + Mime::TEXT + end + end + module Rendering extend ActiveSupport::Concern diff --git a/actionview/lib/action_view/rendering.rb b/actionview/lib/action_view/rendering.rb index 88a3de4a45e212537ca3bd6c1c59563f71ba8c93..db9c4ef50199f278a7d488ff2f59ed55ac71ff0e 100644 --- a/actionview/lib/action_view/rendering.rb +++ b/actionview/lib/action_view/rendering.rb @@ -80,8 +80,6 @@ def view_renderer # Render template to response_body # :api: public def render(*args, &block) - super(*args, &block) - options = _normalize_render(*args, &block) self.response_body = render_to_body(options) end