Rails Routing pt. 2
- Posted by alex on April 4th, 2007 filed in work, ruby on rails
It turned out that the ‘arbitrary constraint’ was a bug afterall. The bug was fixed in release 1.2.3, and has made my life much easier. Since the release, I’ve developed a plugin at Yellowpages.com that allows route generation via query parameters and translation of query parameter keys so that we can use short one character keys like ‘?t=pizza’ instead of ‘?search_terms=pizza’. The configuration is handled in routes.rb, and is as simple as adding a hash :translates => {:t => ’search_terms’} to the route you want to translate. This way, the URL will contain the ‘t’ string in the query parameters, and the application can refer to the parameter as params[:search_terms].
I will be posting the code shortly.
UPDATE:
I have made the plugin publicly available.
April 16th, 2007 at 5:11 am
Hello Son,
I am checking your homepage while in Chicago. To me it loads just as fast as in Chino Hills.
Do people need Akamai or P2P to make their pages and other contents load faster? Does your webhostint service offer this for its customers.
Dad
June 14th, 2007 at 3:28 pm
This sounds great! I need it to translate old PHP style URL’s that will be in my users HTML code from a CMS that I am migrating to Rails. Could you please post the code or email it to me?
June 14th, 2007 at 6:08 pm
I developed the plugin while working my day job @ yellowpages.com. I need to get approval before I can post it here. I will be following up soon.
June 20th, 2007 at 1:14 am
[…] publishing my first rails plugin. This is a plugin I’ve previously talked about developing here and […]