# Update\_attributes unsets my object

**URL:** <https://www.ruby-forum.com/t/update-attributes-unsets-my-object/153741>\
**Category:** Rails\
**Created:** [November 20, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/update-attributes-unsets-my-object/153741 "2008-11-20T18:26:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 20, 2008, 6:26pm UTC](https://www.ruby-forum.com/t/update-attributes-unsets-my-object/153741/1 "2008-11-20T18:26:42Z")

</div>

I just run in a very strange behavior.

In one of my actions, I trigger: @object.update\_attributes(:attr1 =\>  
…)

Now in the corresponding view, @object is nil. Is that a normal behavior  
from Rails? Why would it unset the object?

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 20, 2008, 6:49pm UTC](https://www.ruby-forum.com/t/update-attributes-unsets-my-object/153741/2 "2008-11-20T18:49:56Z")

</div>

On 20 Nov 2008, at 17:26, Fernando P. wrote:

> I just run in a very strange behavior.
> 
> In one of my actions, I trigger: @object.update\_attributes(:attr1 =\>  
> …)
> 
> Now in the corresponding view, @object is nil. Is that a normal  
> behavior  
> from Rails? Why would it unset the object?

I doubt that is the whole story. Post more information

Ffred

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [November 20, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/update-attributes-unsets-my-object/153741/3 "2008-11-20T21:24:43Z")

</div>

Frederick C. wrote:

> On 20 Nov 2008, at 17:26, Fernando P. wrote:
> 
> > I just run in a very strange behavior.
> > 
> > In one of my actions, I trigger: @object.update\_attributes(:attr1 =\>  
> > …)
> > 
> > Now in the corresponding view, @object is nil. Is that a normal  
> > behavior  
> > from Rails? Why would it unset the object?
> 
> I doubt that is the whole story. Post more information
> 
> Ffred

Thank your Frederick for your prompt answer. You were perfectly right, I  
hadn’t seen that I was doing something so stupid as:

@object.update\_attributes(:attr1 =\> @object.attr1)

That kind of recursion is definitely forbidden. I don’t know how such a  
silly idea came to my mind.
