rails 4 activerecord TypeError nil is not a symbol

后端 未结 2 1676
无人及你
无人及你 2021-01-05 02:36

It appears a table in sql server is placing nil in the select statement. I have no idea how to fix this, and if I switch to any other table, I can easily acquir

2条回答
  •  借酒劲吻你
    2021-01-05 03:33

    This is because your table doesn't have a primary_key. You can run a migration like this: (this is rails 5 though)

    class AddFieldToPosaCode < ActiveRecord::Migration[5.0]
      execute 'ALTER TABLE my_table ADD PRIMARY KEY(my_column)'
    end
    

提交回复
热议问题