Supporting tables with Compound Keys

RoR nuby

Ok, I know that RoR < ActiveRecord doesn’t support Compound Keys out of
the box.

I figured I would have to manually code a number of methods to override
the default :id support.

Source:

class ContractCoverages < ActiveRecord::Base

set_table_name “contract_coverages”
set_primary_key “contract_id, coverage_id”

end

I was thinking

  • find
    -update
    -new

What’s weird is I can’t find any examples. Anybody got some
suggestions?

Thanks,
Jason

Don’t do it yourself when it’s already available.

http://compositekeys.rubyforge.org/

It works…I tried it from some stuff I needed to do for a legacy
project.

Steve,

Thank you. I’d see Dr. Nic’s stuff, but I hadn’t noticed the
CompositeKey plugin.

I’m on it.

Thanks,
Jason

On Dec 10, 10:01 am, Steve K. [email protected]