Skip to content

Instantly share code, notes, and snippets.

@bom-d-van
Created May 26, 2012 14:12
Show Gist options
  • Save bom-d-van/2794090 to your computer and use it in GitHub Desktop.
Save bom-d-van/2794090 to your computer and use it in GitHub Desktop.
the simplest way to clone or duplicate an ar record in rails
# http://stackoverflow.com/questions/60033/what-is-the-easiest-way-to-duplicate-an-activerecord-record
# rails < 3.1
new_record = old_record.clone
#rails >= 3.1
new_record = old_record.dup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment