Change the id of an ActiveRecord record

Posted Over 13 years ago. Visible to the public.

You most likely never want to do this. But if you do:

Model.update_all({:id => new_id}, {:id => old_id})
Tobias Kraze
Last edit
About 13 years ago
Keywords
modify, primary, key
License
Source code in this card is licensed under the MIT License.
Posted by Tobias Kraze to makandra dev (2010-11-11 14:06)