> I''ve got a problem with some tables that don''t follow any
RAILS
> standards. how do I define the join in the model when all three tables
> have wacky names?>
Something along the lines:
class Machine < ActiveRecord::Base
has_and_belongs_to_many :pools, :join_table =>
''tbl_CodeMgmt_PoolHost'', :foreign_key =>
''CodeMgmtHostId'',
:assocciation_foreign_key => ''CodeMgmtPoolId''
set_table_name "tbl_CodeMgmt_Host" # must be below has_...
declaration
set_primary_key "Id"
class Pool < ActiveRecord::Base
has_and_belongs_to_many :machines, :join_table =>
''tbl_CodeMgmt_PoolHost'', :foreign_key =>
''CodeMgmtPoolIdCodeMgmtHostId'', :assocciation_foreign_key
=>
''CodeMgmtHostId''
set_table_name "tbl_CodeMgmt_Pool" # must be below has_...
declaration
set_primary_key "Id"
end
Even if I have messed things up, :foreign_key,
:association_foreign_key and :join_table_name are the things to look
at.
Regards,
Rimantas
--
http://rimantas.com/