diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-23 15:26:48 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-23 15:26:48 +0000 |
commit | ab8642c9daaac9db65f67ee85e10e8baa7d60ff8 (patch) | |
tree | 64f345e1b479897069e756ab5cdff9f4faf9fd15 /actionpack | |
parent | f9fca1eb63f3e52f8438d7ddf9f27c9159e7b34a (diff) | |
download | rails-ab8642c9daaac9db65f67ee85e10e8baa7d60ff8.tar.gz rails-ab8642c9daaac9db65f67ee85e10e8baa7d60ff8.tar.bz2 rails-ab8642c9daaac9db65f67ee85e10e8baa7d60ff8.zip |
Added Base#render_component_as_string
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@769 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/components.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb index 3a8fbb97ee..0374a56c10 100644 --- a/actionpack/lib/action_controller/components.rb +++ b/actionpack/lib/action_controller/components.rb @@ -5,21 +5,18 @@ module ActionController #:nodoc: super base.helper do def render_component(options) - @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 + @controller.send(:render_component_as_string, options) end end end protected def render_component(options = {}) #:doc: - 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") unless logger.nil? - return result + component_logging(options) { render_text(component_response(options).body, response.headers["Status"]) } + end + + def render_component_as_string(options) #:doc: + component_logging(options) { component_response(options, false).body } end private @@ -43,5 +40,12 @@ module ActionController #:nodoc: def response_for_component @response.dup end + + def component_logging(options) + logger.info("Start rendering component (#{options.inspect}): ") unless logger.nil? + result = yield + logger.info("\n\nEnd of component rendering") unless logger.nil? + return result + end end end |