One should be able to change the value of a primary key, right? But it’s
not working for me. If I do this:
@drug = Drug.find(tid1) @drug.id = tid2 @drug.category = 'Test2' if @drug.save savedok = 'Saved successfully' else savedok = 'Not saved' end
I get ‘Saved successfully’ but actually the record is not saved or
changed at all, nor is there an error added to the object. If I comment
out the second line, changing the id, the record is updated with the
new category name.
I’m using InnoDB in MySQL 3.23. There are no foreign key’s defined.
Drugs has two “has many” relationships but no “belongs to” ones. The
problem occurs with or without the “has many” relationships.
What’s going on here?