Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: DeepCloning plugin
Homepage: http://blog.defv.be/2008/3/27/activerecord-deepclone-plugin
Clone URL: git://github.com/DefV/deep_cloning.git
Search Repo:
commit  a1efe599d8334948339e38c5a260a3c637a2c04a
tree    cfa47835e302af02b87adc37c9d4ce407159f5e2
parent  753adea9dd0af265270e740bc1dbb090bcd52660
deep_cloning / README.rdoc
100644 26 lines (17 sloc) 0.75 kb

Deep Cloning Plugin

This plugin gives every ActiveRecord::Base object the possibility to do a deep clone.

Repository is on github: http://github.com/DefV/deep_cloning/tree/master

Install with:

  script/plugin install git://github.com/DefV/deep_cloning.git

Example

Cloning a model without an attribute

   pirate.clone :except => :name

Cloning a model without multiple attributes

   pirate.clone :except => [:name, :nick_name]

Cloning one single association

   pirate.clone :include => :mateys

Cloning multiple associations

   pirate.clone :include => [:mateys, :treasures]

Cloning really deep

   pirate.clone :include => {:treasures => :gold_pieces}

Copyright © 2008 Jan De Poorter, released under the MIT license