There's a need for the ability to clone an ARes object that knows of ARes nuances - namely that nested ARes member attributes should not be cloned with it (as that would introduce inconsistencies between prefix_options and the actual parent) and that the pk be ignored. For example:
ryan = Person.find(1)
ryan.address = Address.find(1, :person_id => ryan.id)
not_ryan = ryan.clone
# With the stock clone, the id is copied as well
not_ryan.id # => 1
# With a stock clone, the cloned address's prefix options still point to a person
# with id = 1, which is a break from its true person which does not yet have an id
not_ryan.prefix_options # => {:person_id => 1}
This patch introduced a clone which will both ignore the pk attribute and any member ARes attributes.
ryan = Person.find(1)
ryan.address = StreetAddress.find(1, :person_id => ryan.id)
ryan.hash = {:not => "an ARes instance"}
not_ryan = ryan.clone
not_ryan.new? # => true (id is nil)
not_ryan.address # => NoMethodError
not_ryan.hash # => {:not => "an ARes instance"}
I am not sure whether this deep/shallow clone method would cause confusion (as only non-ARes member attributes are cloned, this is a deep clone with ARes exceptions) - I would welcome any feedback on the matter.