我浏览了许多帖子以生成关联表的迁移,SO
但没有任何效果。google
has many and belongs to many
所有解决方案都生成一个空的迁移文件。
我正在使用rails 3.2.13
,我有两个表:security_users
和assignments
. 这些是我尝试过的一些事情:
rails generate migration assignments_security_users
rails generate migration create_assignments_security_users
rails generate migration create_assignments_security_users_join_table
rails g migration create_join_table :products, :categories (following the official documentation)
rails generate migration security_users_assignments security_user:belongs_to assignments:belongs_to
谁能告诉如何在两个表之间创建连接表迁移?