Hey Perry,

Thanks for the reply.  As for multiple calls to save, I don't have
that in my example (because I'm not doing it).  What I meant was that,
say instead of calling update_attributes, I called save right after
the manual assignment, then called update_attributes again to update
attributes from the params hash.

And that's just what concerns me - I guess I'm just not sure how
update_attributes works.  From the Rails framework documentation:

      # File vendor/rails/activerecord/lib/active_record/base.rb, line
2619
2619:       def update_attributes(attributes)
2620:         self.attributes = attributes
2621:         save
2622:       end

What I don't "get" is how self.attributes = attributes works.
Obviously it's assigning based on the passed-in parameters hash, but
given in my example that hash did NOT contain "condition" or "value",
it seems to skip those and go with whatever the current values are.
And as far as I know, this has been standard with update_attributes
from day one.

So - and somebody please verify or correct my understanding - as long
as the hash I pass in to update_attributes doesn't overwrite my prior
manual assignment methods, this functionality should continue -
through future updates to the framework - to work as expected -
correct?

And if the above is correct, does anybody see anything else wrong that
I may not have considered with doing things this way?

Thanks again =)

On Jun 9, 3:05 pm, Perry Smith <[email protected]>
wrote:
> I don't see the "multiple" calls to save.
>
> update_attributes will call save but I don't see the other call to save.
>
> 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.
> --
> Posted viahttp://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 [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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to