Skip to content

Commit

Permalink
Fist stab on basic rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszx0 committed Aug 25, 2013
1 parent 2c39592 commit aa2d003
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions actionpack/lib/action_controller.rb
Expand Up @@ -13,6 +13,7 @@ module ActionController
autoload :Middleware

autoload_under "metal" do
autoload :BasicRendering, 'action_controller/metal/rendering'
autoload :Compatibility
autoload :ConditionalGet
autoload :Cookies
Expand Down
1 change: 1 addition & 0 deletions actionpack/lib/action_controller/base.rb
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions 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

Expand Down
2 changes: 0 additions & 2 deletions actionview/lib/action_view/rendering.rb
Expand Up @@ -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
Expand Down

0 comments on commit aa2d003

Please sign in to comment.