James Hargreaves wrote:
Hi
Does anyone know anything about the 'resources' keyword in routing? I
can't find any details on how it works or what it is for, but URLs
starting 'resources' definitely appear to be handled differently from
other URLs?
Perhaps this article will help:
http://softiesonrails.com/2007/4/18/rest-101-part-4-routing
James Hargreaves wrote:
Thanks Jacob, very helpful!
A question, I think it is important that the name of a file is maintained in the URL so, for instance, if I uploaded a resource:
my-search-engine-optimised-filename.doc
I would expect it to be available (through the 'resources' enhancement) here:
map.resources 'myfiles'
GET: http://www.mydomain.com/myfiles/12345/my-search-engine-optimised-filename.doc
rather than just:
GET: http://www.mydomain.com/myfiles/12345
Is that something the resources enhancement will support?
Well, the resource identifier (12345) is just an identifier. It could just as well be "some-crazy-filename.doc". It will be put into the params[:id] string. I believe there is a Railscast episode about this, check out railscasts.com.