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 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