1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Updated Mime Negotiations docs [ci skip]

As we all know that Accessing mime types via constants is deprecated. Now, we are using `Mime::Type[:JSON]` instead of `Mime::JSON`
This commit is contained in:
amitkumarsuroliya 2015-09-23 14:38:05 +05:30
parent 1e9593a37c
commit 96eece6cb4
2 changed files with 6 additions and 6 deletions

View file

@ -34,7 +34,7 @@ module ActionController
#
# def authenticate
# case request.format
# when Mime::XML, Mime::ATOM
# when Mime::Type[:XML], Mime::Type[:ATOM]
# if user = authenticate_with_http_basic { |u, p| @account.users.authenticate(u, p) }
# @current_user = user
# else
@ -361,7 +361,7 @@ module ActionController
#
# def authenticate
# case request.format
# when Mime::XML, Mime::ATOM
# when Mime::Type[:XML], Mime::Type[:ATOM]
# if user = authenticate_with_http_token { |t, o| @account.users.authenticate(t, o) }
# @current_user = user
# else

View file

@ -10,7 +10,7 @@ module ActionDispatch
self.ignore_accept_header = false
end
# The MIME type of the HTTP request, such as Mime::XML.
# The MIME type of the HTTP request, such as Mime::Type[:XML].
#
# For backward compatibility, the post \format is extracted from the
# X-Post-Data-Format HTTP header if present.
@ -49,9 +49,9 @@ module ActionDispatch
# Returns the MIME type for the \format used in the request.
#
# GET /posts/5.xml | request.format => Mime::XML
# GET /posts/5.xhtml | request.format => Mime::HTML
# GET /posts/5 | request.format => Mime::HTML or MIME::JS, or request.accepts.first
# GET /posts/5.xml | request.format => Mime::Type[:XML]
# GET /posts/5.xhtml | request.format => Mime::Type[:HTML]
# GET /posts/5 | request.format => Mime::Type[:HTML] or Mime::Type[:JS], or request.accepts.first
#
def format(view_path = [])
formats.first || Mime::NullType.instance