# Composite Keys on RESTful Routes

**URL:** <https://www.ruby-forum.com/t/composite-keys-on-restful-routes/118406>\
**Category:** Rails\
**Created:** [October 26, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/composite-keys-on-restful-routes/118406 "2007-10-26T17:37:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brianb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5e9695/32.png) [@brianb](https://www.ruby-forum.com/u/brianb)\
**Post date:** [October 26, 2007, 5:37pm UTC](https://www.ruby-forum.com/t/composite-keys-on-restful-routes/118406/1 "2007-10-26T17:37:01Z")

</div>

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
