The accepted answer got rid of the error message, but I still could not save @ order.line_items without receiving the error, saying that [: order_id ,: product_id] does not exist.
Finally, I solved this by deleting the line_items table and recreating it with this migration:
def change create_table :line_items do |t| t.references :order t.references :product t.integer :quantity t.timestamps end end
I did not use βlinksβ when I created the table initially that Rails 3 did not mind, but made Rails 4 complaints.
source share