Permalink
Browse files

More component fun

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@748 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 8838020 commit 6cea13a30f5c22ef5cd8ad1fcd14cac6e1d54de9 @dhh dhh committed Feb 22, 2005
Showing with 8 additions and 8 deletions.
  1. +8 −8 actionpack/lib/action_controller/components.rb
@@ -5,25 +5,25 @@ def self.append_features(base)
super
base.helper do
def render_component(options)
- @controller.logger.info("Start rendering component (#{options.inspect}): ")
- result = @controller.send(:component_response, options).body
- @controller.logger.info("\n\nEnd of component rendering")
+ @controller.logger.info("Start rendering component (#{options.inspect}): ") unless @controller.logger.nil?
+ result = @controller.send(:component_response, options, false).body
+ @controller.logger.info("\n\nEnd of component rendering") unless @controller.logger.nil?
return result
end
end
end
protected
def render_component(options = {}) #:doc:
- response = component_response(options, true)
- logger.info "Start rendering component (#{options.inspect}): "
+ response = component_response(options)
+ logger.info("Start rendering component (#{options.inspect}): ") unless logger.nil?
result = render_text(response.body, response.headers["Status"])
- logger.info("\n\nEnd of component rendering")
+ logger.info("\n\nEnd of component rendering") unless logger.nil?
return result
end
private
- def component_response(options, reuse_response = false)
+ def component_response(options, reuse_response = true)
component_class(options).process(request_for_component(options), reuse_response ? @response : response_for_component)
end
@@ -41,7 +41,7 @@ def request_for_component(options)
end
def response_for_component
- Marshal::load(Marshal::dump(@response))
+ @response.dup
end
end
end

0 comments on commit 6cea13a

Please sign in to comment.