Got bit by this a couple of weeks ago. +1 for the merge.

Dheeraj Kumar


On Saturday 21 July 2012 at 6:14 AM, Peter Brown wrote:

> Just stumbled upon a pull request from last year 
> (https://github.com/rails/rails/pull/3023) with some discussion and it seemed 
> like people were generally in favor of changing the behavior. I'd be willing 
> to bring it back to life if people are still interested in it.
> 
> On Friday, July 20, 2012 6:45:31 PM UTC-4, Matt jones wrote:
> > 
> > On Jul 20, 2012, at 5:48 PM, Peter Brown wrote: 
> > 
> > > I ran into an interesting issue today with ActiveRecord's becomes method 
> > > and discovered that it is mutating the receiver without me knowing it. 
> > > 
> > > The API docs say 
> > > 
> > > "The new instance will share a link to the same attributes as the 
> > > original class. So any change to the attributes in either instance will 
> > > affect the other." 
> > > 
> > > However, it doesn't say that the type attribute is changed on the 
> > > receiver just by the method call. 
> > 
> > 'type' is an attribute; it gets changed - and the docs say the changes will 
> > happen to both. A bit unclear, but not a bug. 
> > 
> > Definitely worth an update to the documentation, though. 
> > 
> > --Matt Jones 
> > 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/rubyonrails-core/-/22M16_XMSnYJ.
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[email protected]).
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-core?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to