Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

ActiveRecord::Base#dup is now gone?

#875

I see this method in ActiveResource::Base but not ActiveRecord::Base

When I call dup on an active record object I wind up with


b = a.dup

b == a #true

because b and a have the same id, which is not how the documentation says ActiveRecord::Base#dup works

Reported by azimux · August 20th, 2008 @ 11:56 PM

State: invalid
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung

    They have the same id in that they correspond to the same database row but they are different objects (check their object_id). Are you thinking of clone ?

    August 21st, 2008 @ 02:02 AM

  2. azimux
    azimux
    • Tag cleared.

    Oh, it looks like ActiveRecord::Base never had a dup method, nevermind.

    I should indeed be using clone, thanks Frederick

    This ticket can be closed

    August 21st, 2008 @ 02:40 AM

  3. Pratik
    Pratik
    • State changed from new to invalid

    August 21st, 2008 @ 11:15 AM