0
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

Any help is appreciated.

4
  • did you run rake db:migrate from scratch? Commented Sep 12, 2016 at 1:44
  • also what is to do with [5.0]? Commented Sep 12, 2016 at 1:48
  • 1
    Please format your question properly so that it's readable. Use the { } in the format bar to mark formatted code. Commented Sep 12, 2016 at 1:52
  • Run rake db:migrate with --trace option. rake db:migrate --trace which gives you more info on where exactly it is erroring out. Commented Sep 12, 2016 at 1:54

1 Answer 1

3
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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.