What is the easiest way to duplicate an activerecord record?
To get a copy, use the dup (or clone for < rails 3.1+) method: #rails >= 3.1 new_record = old_record.dup # rails < 3.1 new_record = old_record.clone Then you can change whichever fields you want. ActiveRecord overrides the built-in Object#clone to give you a new (not saved to the DB) record with an unassigned ID. … Read more