0

To change an id in rails its like Invoice.create(id: 25) works but in my new.html.erb, i have user specify an id (:invoiceid) and i want that id to be linked to that id.

so how do you do it? Invocie.create(id: invoiceid) wont work.

Oscar
  • 43
  • 4

1 Answers1

0

Why do you even want to change primary id, please read these responses here link1 link2, and still if you want to edit that then you will have to permit that field in strong params, like this

params.require(:my_model).permit(:id)

Community
  • 1
  • 1
Saad
  • 1,856
  • 1
  • 22
  • 28