Pivotal Labs

Standup 07/21/2008

edit Posted by Davis W. Frank on Monday July 21, 2008 at 04:45PM

Interesting Things

  • Model#update_all is your friend if you're not yet on Rails 2.1

    Like Model#update_attribute for each attribute, #update_all will save direct to the database, bypassing validation, updating only the columns you specify. In Rails 2.1, with partial model updates, you may not need this. But if you've not yet upgraded your application, then give #update_all a try.

Update: fixed per comment. Model#update_attribute does not validate. Thanks for the catch!

Comments

  1. Stijn Stijn on July 22, 2008 at 07:23AM

    Hello, Model#update_all is indeed great, but it's Model#update_attribute that skips the validation checks (not update_attributes).

  2. Davis W. Frank Davis W. Frank on July 22, 2008 at 05:46PM

    Stijn - thanks for the catch. Now fixed.

Add a Comment (MarkDown available)