I tried to clone one of my objects today, but it seems that it does not work, as in the documentation.
In my console, I do:
u = User.find 1 nu = u.clone nu.new_record? => false nu.new? NoMethodError: undefined method `new?' for #<User:0x007fbf137b8278>
So, it looks like the cloned object is just a duplicate, because it has the same identifier as the old one, but according to the documentation it should be a new object?
clone ()
Returns a clone of a resource that has not yet been assigned an identifier, and is treated as a new resource.
ryan = Person.find (1)
not_ryan = ryan.clone
not_ryan.new? # => true
source share