Rails - How to add a format to an url helper? Rails - How to add a format to an url helper? ruby-on-rails ruby-on-rails

Rails - How to add a format to an url helper?


You should be able to do something like this:

some_resource_path(format: :json)

or

some_resource_url(format: :xml)


I'm fairly new to Rails/Ruby, so I'm not sure why, but in my Rails 3.2 application the syntax must be eg:

some_resource_path(:format => :json)