I have a link table which looks like this:
create_table "links", :id => false, :force => true do |t|
t.integer model1_id
t.integer model2_id
t.string someotherinfo
end
I'm currently defining routes like this:
match '/links/:model1_id/:model2_id/' => buggable_links#validate
It seems like I ought to be able to do something more like resources
rather than writing out all the match
statements. What's the right way of having rails generate resource routes on models which do not have a single primary key, such that URLs contain two IDs?
N.B. I'm aware that one possible answer is 'just add an autoincrementing pk'. The pros and cons of that are discussed in this question, but for the purposes of this question let's assume I want to leave my DB schema as it is.