Problem with Using composite_primary_keys with generated scaffolds

1 view
Skip to first unread message

Philip Nelson

unread,
Feb 26, 2007, 5:25:01 AM2/26/07
to rubyonrai...@googlegroups.com
Folks,

To get round the "problem" (for RoR) of having composite primary keys in my
legacy database, I've used the gem composite_primary_keys.

However when I access the views generated by the generate/scaffold command it
has a problem. The "list" option works perfectly, but the "edit" and "show"
have problems with the two part key -

no route found to match "/aircraft_history/show/35707,4" with {:method=>:get}

I've had a suggestion that I need to set up "special routes" for these. But
that doesn't sound like a neat solution. Here's the suggestion -

"In your routes.rb file, you should put the following:
map.connect ':controller/:action/:aircraft_id,:aircraft_sequence'"

It would mean I'd have to set up a special route each time I need to call
using a composite key. Isn't there a better way ?

Phil

ed_ruder

unread,
Apr 26, 2007, 2:54:12 AM4/26/07
to Ruby on Rails meets the Legacy World
Phil,

Have you posted to http://compositekeys.rubyforge.org/?

Ed

Reply all
Reply to author
Forward
0 new messages