Friday, August 24, 2012

Rails DOT Routing

The default rout match for rails considers the dot as a place holder for the format type that is expected in return.
When implementing a free text search over GET, its important to change this configuration.

Default configuration:
match ':controller(/:action(/:id))(.:format)'

This will not handle a query as following:
/site/search/I am looking for . in a sentence

A working configuration would look like the following:
match ':controller(/:action(/:id))',:id => /[^\/]*/


Found at the coding journal

No comments:

Post a Comment

Please do not post spam on this blog, Spam sites will be reported to google.
thank you kindly.