Update_attributes unsets my object

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?

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs