diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-19 18:25:52 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-19 18:25:52 -0200 |
commit | 1b4edd173dc2cbe53e48777d3e17be3164513539 (patch) | |
tree | 9ef1dda909373e556c8ccec5664196ed2f5536e3 /actionpack | |
parent | 0a3f57e85a0825f31d93303eb6f2c7f40fce57f8 (diff) | |
download | rails-1b4edd173dc2cbe53e48777d3e17be3164513539.tar.gz rails-1b4edd173dc2cbe53e48777d3e17be3164513539.tar.bz2 rails-1b4edd173dc2cbe53e48777d3e17be3164513539.zip |
Use performed? instead of checking for response_body
* Check for performed? instead of response_body
* Change performed? to return a boolean
* Refactor AC::Metal#response_body= to reuse variable
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/metal.rb | 8 | ||||
-rw-r--r-- | actionpack/lib/action_controller/metal/implicit_render.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/force_ssl_test.rb | 3 |
3 files changed, 5 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/metal.rb b/actionpack/lib/action_controller/metal.rb index 691fb24d0f..92433ab462 100644 --- a/actionpack/lib/action_controller/metal.rb +++ b/actionpack/lib/action_controller/metal.rb @@ -181,13 +181,13 @@ module ActionController @_status = Rack::Utils.status_code(status) end - def response_body=(val) - body = (val.nil? || val.respond_to?(:each)) ? val : [val] - super body + def response_body=(body) + body = [body] unless body.nil? || body.respond_to?(:each) + super end def performed? - response_body + !!response_body end def dispatch(name, request) #:nodoc: diff --git a/actionpack/lib/action_controller/metal/implicit_render.rb b/actionpack/lib/action_controller/metal/implicit_render.rb index e8e465d3ba..ae04b53825 100644 --- a/actionpack/lib/action_controller/metal/implicit_render.rb +++ b/actionpack/lib/action_controller/metal/implicit_render.rb @@ -2,7 +2,7 @@ module ActionController module ImplicitRender def send_action(method, *args) ret = super - default_render unless response_body + default_render unless performed? ret end diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb index 125012631e..3ea3c06ac4 100644 --- a/actionpack/test/controller/force_ssl_test.rb +++ b/actionpack/test/controller/force_ssl_test.rb @@ -39,10 +39,8 @@ class ForceSSLFlash < ForceSSLController @flashy = flash["that"] render :inline => "hello" end - end - class ForceSSLControllerLevelTest < ActionController::TestCase tests ForceSSLControllerLevel @@ -135,5 +133,4 @@ class ForceSSLFlashTest < ActionController::TestCase assert_equal "hello", assigns["flash_copy"]["that"] assert_equal "hello", assigns["flashy"] end - end |