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/layouts_and_rendering.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/layouts_and_rendering.md')
-rw-r--r-- | guides/source/layouts_and_rendering.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md index 0875941e29..fa303745b8 100644 --- a/guides/source/layouts_and_rendering.md +++ b/guides/source/layouts_and_rendering.md @@ -137,7 +137,7 @@ If you want to render the view that corresponds to a different template within t ```ruby def update @book = Book.find(params[:id]) - if @book.update_attributes(params[:book]) + if @book.update(params[:book]) redirect_to(@book) else render "edit" @@ -145,14 +145,14 @@ def update end ``` -If the call to `update_attributes` fails, calling the `update` action in this controller will render the `edit.html.erb` template belonging to the same controller. +If the call to `update` fails, calling the `update` action in this controller will render the `edit.html.erb` template belonging to the same controller. If you prefer, you can use a symbol instead of a string to specify the action to render: ```ruby def update @book = Book.find(params[:id]) - if @book.update_attributes(params[:book]) + if @book.update(params[:book]) redirect_to(@book) else render :edit |