Rails has_and_belongs_to_many migration
问题 I have two models restaurant and user that I want to perform a has_and_belongs_to_many relationship. I have already gone into the model files and added the has_and_belongs_to_many :restaurants and has_and_belongs_to_many :users I assume at this point I should be able to do something like with Rails 3: rails generate migration .... but everything I have tried seems to fail. I'm sure this is something really simple I'm new to rails so I'm still learning. 回答1: You need to add a separate join