diff options
author | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-08-02 15:47:39 +0200 |
---|---|---|
committer | Łukasz Strzałkowski <lukasz.strzalkowski@gmail.com> | 2013-08-25 11:39:13 +0200 |
commit | aa2d0038127f3b0d25e0f9dbb941c6dd0b2714c3 (patch) | |
tree | 2cd438c942cbe8ca6a60fceb1457f3f8cd312671 /actionpack | |
parent | 2c395923491768c51c64ab2d5079448e4a9477d1 (diff) | |
download | rails-aa2d0038127f3b0d25e0f9dbb941c6dd0b2714c3.tar.gz rails-aa2d0038127f3b0d25e0f9dbb941c6dd0b2714c3.tar.bz2 rails-aa2d0038127f3b0d25e0f9dbb941c6dd0b2714c3.zip |
Fist stab on basic rendering
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/base.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/rendering.rb | 18 |
3 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index d08e3c4e8e..0233937a25 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 3fd5fb90d2..9941c06201 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 abcc9d4acf..2d58e1440c 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 |