On 5 August 2010 13:40, bingo bob <[email protected]> wrote: >... > Just a point that I've always found slightly confusing. If I've > understood correctly this line.. > > if @record.update_attributes(params[:sample]) > > actually *does* the updating part, believe the if is there for error > trapping and returning. > > I've always struggled as to why that line starts with the word "if", am > I reading it right in that the line basically does the update_attributes > "if" it can? Maybe I'm just thinking about it wrong but it doesn't seem > intuitive to me.
Yes, it returns true if the save succeeds. You could have answered this yourself easily by looking at the docs. http://api.rubyonrails.org/classes/ActiveRecord/Base.html Colin -- 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.

