The request.format object in Rails is always set. If the user has not specified a value in their URL, e.g. example.com/projects.json, then it will default to :html.

To check if the user has chosen the request format, use this piece of code:

    params[:format].nil?