【问题标题】:Rails: HABTM Relationship with id as Primary Key, legacy DBRails:以 id 作为主键的 HABTM 关系,遗留数据库
【发布时间】:2011-03-20 01:14:54
【问题描述】:

我有一个带有以 ID 作为主键的连接表的旧数据库...有什么我可以做的吗?

谢谢!

【问题讨论】:

    标签: ruby-on-rails associations primary-key has-and-belongs-to-many


    【解决方案1】:

    不要使用 has_and_belongs_to_many,而是使用

    has_many :whatevers, :through => :habtm_table
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多