aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-06-17 00:58:50 +0300
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-06-17 00:58:50 +0300
commit422292dc98cf42b20758025bf55b5b84260aecb4 (patch)
tree7580a19594ef6b6d436e86dd982d1a6677f824a3 /actionpack/lib
parentaf01f45f068ea382257090ec8a3aa2579e56dbdc (diff)
downloadrails-422292dc98cf42b20758025bf55b5b84260aecb4.tar.gz
rails-422292dc98cf42b20758025bf55b5b84260aecb4.tar.bz2
rails-422292dc98cf42b20758025bf55b5b84260aecb4.zip
Document, refactor and create test case for ActionDispatch::Response#charset= method
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/http/response.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb
index aae011fd6a..8c965793cd 100644
--- a/actionpack/lib/action_dispatch/http/response.rb
+++ b/actionpack/lib/action_dispatch/http/response.rb
@@ -187,13 +187,13 @@ module ActionDispatch # :nodoc:
@content_type = content_type.to_s
end
- # Sets the HTTP character set.
+ # Sets the HTTP character set. In case of nil parameter
+ # it sets the charset to utf-8.
+ #
+ # response.charset = 'utf-16' # => 'utf-16'
+ # response.charset = nil # => 'utf-8'
def charset=(charset)
- if nil == charset
- @charset = self.class.default_charset
- else
- @charset = charset
- end
+ @charset = charset.nil? ? self.class.default_charset : charset
end
# The response code of the request.