You wanna to associate with another record in table1 or change table1.id?
if it's option 1, you need to remove that association and set a new one.
If option 2, check you db and see if update cascade yes enabled for this fk and than get record and change value of id.