Rails Routing pt. 2

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.


4 Responses to “Rails Routing pt. 2”

  1. Minh Le Says:

    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

  2. Brendon Says:

    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? :)

  3. admin Says:

    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.

  4. Alex Le » Rails Routing pt. 3 Says:

    […] publishing my first rails plugin. This is a plugin I’ve previously talked about developing here and […]

Leave a Comment