const orginial = someObject.foo;
someObject.foo = function() {
if (condition) orginial.bind(this)(...arguments);
};
当我运行rake db:migrate时 它被中止并给出以下错误: 没有将String隐式转换为Integer
感谢任何帮助。
答案 0 :(得分: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
您错过了add_index行的逗号。