Change the id of an ActiveRecord record

Updated . Posted . 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
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)