Composite Keys on RESTful Routes

I am building an app with existing controllers/actions, using
traditional rails routes. I recently started moving over to RESTful
routes and have hit a snag. Now I am reconsidering my whole effort
and may go back to the original, more flexible, map.connect method.

My problem is, one of the resources has composite keys. The keys are
both strings as well, and can include dots. Here’s an example of what
I would like to do:

/books/Thomas.Pynchon/Gravity%27s+Rainbow

This works using traditional routes (/books/:author/:title), but it
does not work using RESTful routes.

The first trick is the dot. I can get around that by putting this in
my environment.rb file:
ActionController::Routing::SEPARATORS = %w(/ ; , ?) # no dot (.) in
this list

The second thing is the slash, which I can’t get around unless I url-
encode it, which isn’t what I want. I want two parameters passed to
my resource, separated by a /, as a composite key. Thoughts? Ideas?
Help?

Thanks,
Brian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs