1

在我的数据库中,OptionSet 与其他 OptionSet 相关联。如果我要连接两个单独的表,我会创建一个简单的连接表。然而,Rails 喜欢将其外键命名为 <singular_table_name>_id,即 optionset_id。但是,如果我将表与自身连接起来,我显然不能为这两个表提供相同的名称。我该如何处理?

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

1 回答 1

5

老兄,你的问题有一个完美的答案:

Rails中相同模型的多对多关系?

于 2010-01-31T09:29:28.587 回答