On 20 Feb 2007, at 13:23, glenn wrote:
I’m migrating my site over to a more RESTful style and I’m having some
trouble with the URL helpers. If I have two links on my page, how to I
make one target the .html format of a given resource and the other to
target the .xml format?
REST is all about using the HTTP protocol to determine which format
to serve. I’m assuming you want to use RESTful routes. If the HTTP
header asks for an XML representation, your method will return XML,
if (X)HTML is requested, it will serve a normal web page. Generate a
RESTful scaffold using “script/generate scaffold_resource something
field1:string field2:string” and have a look at the code.
There are ways around this, but it’s better to stick with the
convention. For urls with a certain format, you can use the
Peter De Berdt