How to map non-REST URLS to REST ones?

Posted by Krzysztof Luks on Stack Overflow See other posts from Stack Overflow or by Krzysztof Luks
Published on 2010-05-18T09:42:21Z Indexed on 2010/05/18 13:30 UTC
Read the original article Hit count: 188

Filed under:
|
|

I have a small rails app that has default scaffold generated routes eg. /stadia/1.xml. However I have to support legacy client app that can't construct such URLs correctly. What I need to do is to map URL in the form:

/stadia?id=1?format=xml to /stadia/1.xml

Or even something like:

/myApp?model=<model_name>?id=<id>?format=xml to /<model_name/<id>.xml

Is it possible to craft appropriate route in Rails?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about routing