diff options
author | Xavier Noria <fxn@hashref.com> | 2013-01-26 17:41:56 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2013-01-26 17:41:56 +0100 |
commit | 0b5d3f32732f637fe29848a3597852dce9662c6b (patch) | |
tree | a0e75011bd90c1d7cde73a89b680c52ab0a589ec /actionpack/lib/action_dispatch | |
parent | 474e7dd82af030fb22ab5a586976d21b3497882a (diff) | |
parent | 4313461587254fd8e5b5a8ea7dfc9f0230c70ecb (diff) | |
download | rails-0b5d3f32732f637fe29848a3597852dce9662c6b.tar.gz rails-0b5d3f32732f637fe29848a3597852dce9662c6b.tar.bz2 rails-0b5d3f32732f637fe29848a3597852dce9662c6b.zip |
Merge remote-tracking branch 'docrails/master'
Conflicts:
actionpack/lib/action_view/helpers/form_options_helper.rb
guides/code/getting_started/app/controllers/comments_controller.rb
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 91cf4784db..e7e8905d7e 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -137,6 +137,7 @@ module ActionDispatch # :nodoc: @committed end + # Sets the HTTP status code. def status=(status) @status = Rack::Utils.status_code(status) end @@ -145,16 +146,24 @@ module ActionDispatch # :nodoc: @content_type = content_type.to_s end - # The response code of the request + # The response code of the request. def response_code @status end - # Returns a String to ensure compatibility with Net::HTTPResponse + # Returns a string to ensure compatibility with <tt>Net::HTTPResponse</tt>. def code @status.to_s end + # Returns the corresponding message for the current HTTP status code: + # + # response.status = 200 + # response.message # => "OK" + # + # response.status = 404 + # response.message # => "Not Found" + # def message Rack::Utils::HTTP_STATUS_CODES[@status] end @@ -172,6 +181,8 @@ module ActionDispatch # :nodoc: stream.to_path end + # Returns the content of the response as a string. This contains the contents + # of any calls to <tt>render</tt>. def body strings = [] each { |part| strings << part.to_s } @@ -180,6 +191,7 @@ module ActionDispatch # :nodoc: EMPTY = " " + # Allows you to manually set or override the response body. def body=(body) @blank = true if body == EMPTY |