Wow, thanks for such great feedback Perry and Fred!  You both hit the
point from multiple angles, all of which are important.  Thank you
both very much for your help!

On Jun 9, 6:02 pm, Perry Smith <[email protected]>
wrote:
> Phoenix Rising wrote:
> > 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?
>
> I believe that is a safe assumption.  I think Fred (two posts up) has a
> valid point but may not be what you are worried about right now.
>
> Usually, what I do is merge the added options in and then call
> update_attributes.  Forgive the syntax but something like
>
> new_options = params[:car].merge({
>     :condition => "Good",
>     :value => "$24,924"
>   })
>
> @car.update_attributes(new_options)
>
> The general gist is (and I think you already know this):
>   1) setting @car.xyz = 5 does not do a save
>   2) update_attributes could blow away previous sets if it contains the
> same attribute
>   3) attributes not in the hash passed to update_attributes are not
> altered (how could they?)
>
> As far as "idioms", your style you will not see in Ruby code as often as
> some form of merging the options and then calling update_attributes.  It
> is a bit slower that way but Ruby programmers seem to want clarity over
> a tiny bit if performance.
> --
> 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