I am creating a tinyurl clone based off of Robby Rusell's Rubyurl. The purpose of the app is to not only shrink the size of a URL, but to also track how the new URL is being used. For example, if I wanted to create a new tiny URL to be used on behalf of one of my clients, I'd want to somehow pass a client ID to the new tiny URL so that it would look something like this: www.rubyurlclone.com/clientID/random_token
Question: how do I insert that clientID? Having a hard time wrapping my brain around this one.
Well, doing anything with how your routes are generated would be handled in the routes.rb file. A simple example(not realistic without more detailed info):
in routes.rb: map.connect ':clientID/:random_token ',
:controller => 'my_controller', :action => 'my_action'
in view: link_to 'my_link', :controller => 'my_controller', :action => 'my_action', :clientID => params[:client_id], :random_token => params[:random_token]
I hope this gets you headed down the right path.