Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c1837043c8
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (19 sloc) 0.857 kb

Deep Cloning Plugin

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

Repository is on github: 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.dup :except => :name

Cloning a model without multiple attributes

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

Cloning one single association

pirate.dup :include => :mateys

Cloning multiple associations

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

Cloning really deep

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

Cloning really deep with multiple associations

pirate.dup :include => [:mateys, {:treasures => :gold_pieces}]

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

Jump to Line
Something went wrong with that request. Please try again.