2010-01-31 73 views
1

在我的數據庫中,OptionSets與其他OptionSet關聯。如果我加入兩個單獨的表格,我會創建一個簡單的連接表。但是,Rails喜歡將其外鍵名爲<singular_table_name> _id,即optionset_id。但是,如果我自己加入表格,我顯然不能給這兩個表格命名。我如何處理這個問題?通過Rails中的多對多加入表格

create_table :optionsets_optionsets do |t| 
    t.column :optionset_id, :integer 
    t.column :dependent_optionset_id, :integer # how do i deal with this? 
end

回答