I've created a patch for this change which can be found at
https://rails.lighthouseapp.com/projects/8994/tickets/3164. All the
tests pass and #clone acts correctly. However I'd really appreciate
some feedback on one niggling point regarding when the
after_initialize callbacks get run.
--~--~--
On Thu, Aug 13, 2009 at 12:58 PM, Paul
Gillard wrote:
> Currently ActiveRecord::Base overrides #clone and creates clones using
> #new. This means newly cloned objects are initialized via a
> combination of #clone and #initialize instead of via #initialize_copy.
> Is the Rails core group interested
+1, overriding initialize_copy is the correct way. We shouldn't be
overriding dup and clone.
On Thu, Aug 13, 2009 at 2:58 PM, Paul
Gillard wrote:
>
> In Ruby when an object is cloned the newly created object is
> initialized via #initialize_copy. Only new objects are initialized via
> #initialize