Restful routing link_to format

Hi,

I can’t seem to find how to define the format in my links. My link looks
like this now:

<%= link_to ‘Show’, resource_path(@resource) %>

But how do I specify the format? Do I realy need to create the url
myself?

Thank you in advance.

resource_path(@resource, :format => :xml)
On Sun, May 25, 2008 at 9:46 PM, Michael R. <
[email protected]> wrote:

Thank you in advance.

Posted via http://www.ruby-forum.com/.


Appreciated my help?
Recommend me on Working With Rails
http://workingwithrails.com/person/11030-ryan-bigg

if you do rake routes you should see there are a bunch of additional
routes like

formatted_resource_path

you can use those to specify a path to an xml, rss etc file e.g.

link_to(‘Show XML’, formatted_resource_path(@resource, :format
=> :xml))

Think that should work…

Joe

On May 25, 1:34 pm, Michael R. [email protected]

Ok, I thought is was this way. But how can I get the url format like

xxx.xml and not like

xxx?format=xml ?

I have

map.connect ‘:controller/:action/:id.:format’

specified in my routes.rb

Thank you for the quick reply btw