简体   繁体   English

Rails:不会将String隐式转换为Integer

[英]Rails: no implicit conversion of String into Integer

class CreateAdminUsersPagesJoin < ActiveRecord::Migration[5.0]
  def up
    create_table :admin_users_pages2, :id => false  do |t|
      t.integer "admin_user_id"
      t.integer "page_id"
    end
    add_index :admin_users_pages2 ["admin_user_id", "page_id"]
  end

  def down
    drop_table :admin_users_pages2
  end
end

When i run rake db:migrate It gets aborted and gives the following error: no implicit conversion of String into Integer 当我运行rake db:migrate时,它将中止并给出以下错误:没有将String隐式转换为Integer

Any help is appreciated. 任何帮助表示赞赏。

class CreateAdminUsersPagesJoin < ActiveRecord::Migration[5.0]
  def up
    create_table :admin_users_pages2, :id => false  do |t|
      t.integer "admin_user_id"
      t.integer "page_id"
    end
    add_index :admin_users_pages2, ["admin_user_id", "page_id"]
  end

  def down
    drop_table :admin_users_pages2
  end
end

You had missed comma for add_index line. 您错过了add_index行的逗号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM