Thursday, May 27, 2010

[Rails] Re: Using update_attributes(params[:something]) w/ manual assignment

Jose Ambros-ingerson wrote:
> Perry Smith wrote:
>
>>
>> By the way, update_attributes calls save (as of 2.3.2? or was it before
>> that) only if at least one attribute has changed.
>

Though failure to behave this way (see above) is hurting me;
I have an observer that get's triggered on the save, but if the save
didn't change anything (the record attributes are the same as before the
save) I would of preferred that the observer had not been triggered.

Is writing a custom update_attributes (that does a save only if it would
result in different attribute values) the way to go?

THanks in advance for your help, Jose
--
Posted via http://www.ruby-forum.com/.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate