Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
carlosantoniodasilva authored and prasath committed Feb 7, 2012
1 parent 9eeb8fc commit 899d866
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
8 changes: 4 additions & 4 deletions actionpack/lib/action_controller/metal.rb
Expand Up @@ -181,13 +181,13 @@ def status=(status)
@_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:
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/metal/implicit_render.rb
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions actionpack/test/controller/force_ssl_test.rb
Expand Up @@ -39,10 +39,8 @@ def use_flash
@flashy = flash["that"]
render :inline => "hello"
end

end


class ForceSSLControllerLevelTest < ActionController::TestCase
tests ForceSSLControllerLevel

Expand Down Expand Up @@ -135,5 +133,4 @@ def test_cheeseburger_redirects_to_https
assert_equal "hello", assigns["flash_copy"]["that"]
assert_equal "hello", assigns["flashy"]
end

end

0 comments on commit 899d866

Please sign in to comment.