diff options
author | Amparo Luna + Guillermo Iguaran <amparo.m.luna@gmail.com+guilleiguaran@gmail.com> | 2013-01-02 16:40:48 -0500 |
---|---|---|
committer | Amparo Luna + Guillermo Iguaran <amparo.m.luna@gmail.com+guilleiguaran@gmail.com> | 2013-01-03 12:04:25 -0500 |
commit | 03ac174f2d35c92ffefd35a7f69369eb5117d8a7 (patch) | |
tree | 3c9a6c226b04f11a92d9d57cf9017e5ad57e31ea /guides/source/active_record_basics.md | |
parent | 1bb020063c1bad6cc6a2ad7a4635bfc31a308f65 (diff) | |
download | rails-03ac174f2d35c92ffefd35a7f69369eb5117d8a7.tar.gz rails-03ac174f2d35c92ffefd35a7f69369eb5117d8a7.tar.bz2 rails-03ac174f2d35c92ffefd35a7f69369eb5117d8a7.zip |
Change guides to use update instead of update_attributes
Diffstat (limited to 'guides/source/active_record_basics.md')
-rw-r--r-- | guides/source/active_record_basics.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/active_record_basics.md b/guides/source/active_record_basics.md index 883c2dda4a..c90f42c492 100644 --- a/guides/source/active_record_basics.md +++ b/guides/source/active_record_basics.md @@ -277,7 +277,7 @@ value, like so: ```ruby user = User.find_by_name('David') -user.update_attributes(name: 'Dave') +user.update(name: 'Dave') ``` This is most useful when updating several attributes at once. If, on the other @@ -307,10 +307,10 @@ models and validate that an attribute value is not empty, is unique and not already in the database, follows a specific format and many more. Validation is a very important issue to consider when persisting to database, so -the methods `create`, `save` and `update_attributes` take it into account when +the methods `create`, `save` and `update` take it into account when running: they return `false` when validation fails and they didn't actually perform any operation on database. All of these have a bang counterpart (that -is, `create!`, `save!` and `update_attributes!`), which are stricter in that +is, `create!`, `save!` and `update!`), which are stricter in that they raise the exception `ActiveRecord::RecordInvalid` if validation fails. A quick example to illustrate: |