Displaying 1 result from an estimated 1 matches for "fookey".
Did you mean:
pookey
2010 Aug 19
1
Composite primary keys and :joins=>
I have a legacy db with the following simplified structure:
Table-A:
type_key, code_key, name, ... # PKs are type_key and code_key,
there is no id col and I cannot alter this db
Table-B: # each row has only the code as a foreign_key, the type_key
is hard-coded to "FOOKEY"
an_id, code, ...
Models:
class TableB < AR::Base
set_table_name ''table_b''
set_primary_key :an_id # singular PK
belongs_to :code_name, :class_name=>''TableA'', :primary_key=>:pk_code_name, :foreign_key=>:code
SELECT = "...