instance method
format
Ruby on Rails 8.0.4
Since v3.0.20Signature
format(_view_path = nil)
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
Parameters
-
_view_pathopt = nil
Source
# File actionpack/lib/action_dispatch/http/mime_negotiation.rb, line 68
def format(_view_path = nil)
formats.first || Mime::NullType.instance
end
Defined in actionpack/lib/action_dispatch/http/mime_negotiation.rb line 68
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Http::MimeNegotiation