mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
More component fun
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@748 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
8838020ac4
commit
6cea13a30f
1 changed files with 8 additions and 8 deletions
|
@ -5,9 +5,9 @@ module ActionController #:nodoc:
|
||||||
super
|
super
|
||||||
base.helper do
|
base.helper do
|
||||||
def render_component(options)
|
def render_component(options)
|
||||||
@controller.logger.info("Start rendering component (#{options.inspect}): ")
|
@controller.logger.info("Start rendering component (#{options.inspect}): ") unless @controller.logger.nil?
|
||||||
result = @controller.send(:component_response, options).body
|
result = @controller.send(:component_response, options, false).body
|
||||||
@controller.logger.info("\n\nEnd of component rendering")
|
@controller.logger.info("\n\nEnd of component rendering") unless @controller.logger.nil?
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -15,15 +15,15 @@ module ActionController #:nodoc:
|
||||||
|
|
||||||
protected
|
protected
|
||||||
def render_component(options = {}) #:doc:
|
def render_component(options = {}) #:doc:
|
||||||
response = component_response(options, true)
|
response = component_response(options)
|
||||||
logger.info "Start rendering component (#{options.inspect}): "
|
logger.info("Start rendering component (#{options.inspect}): ") unless logger.nil?
|
||||||
result = render_text(response.body, response.headers["Status"])
|
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
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
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)
|
component_class(options).process(request_for_component(options), reuse_response ? @response : response_for_component)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ module ActionController #:nodoc:
|
||||||
end
|
end
|
||||||
|
|
||||||
def response_for_component
|
def response_for_component
|
||||||
Marshal::load(Marshal::dump(@response))
|
@response.dup
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue