Ruby on Rails Wednesday, June 30, 2010

I've written a routine for encoding and decoding custom urls.

My route looks like:

map.browse 'items/browse/*query', :controller => 'items', :action =>

Now the param query is suposed to look something like:


Now I've got the routines built to decode this and turn it into a
thinking sphinx search hash, and I have the code to turn the TS hash
into that url. My problem is, I need access to that code in both the
controller and the view, where is the best place to put this code so
it is accessible in those two locations without repeating the code.

Is there a better way to do this, becaue at the moment in order to
form links I am using code like

link_to "foo", browse_url(:query => parse_browse_url(hash))

I'd appreciate any input.


You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment