diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-01-03 09:09:59 -0800 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2013-01-03 09:09:59 -0800 |
commit | cb2bd4aa619d9329c42aaf6d9f8eacc616ce53f4 (patch) | |
tree | 409db16994e4a96c8ac08a04a0a37dd34df7c2cb /guides/source/layouts_and_rendering.md | |
parent | b4a23edc106f0c74aaa71fc605b76429064e3436 (diff) | |
parent | d826f14443a8030068324b1fcab8dc0f1fc87c9d (diff) | |
download | rails-cb2bd4aa619d9329c42aaf6d9f8eacc616ce53f4.tar.gz rails-cb2bd4aa619d9329c42aaf6d9f8eacc616ce53f4.tar.bz2 rails-cb2bd4aa619d9329c42aaf6d9f8eacc616ce53f4.zip |
Merge pull request #8705 from amparo-luna/change_update_attributes_to_update
Rename update_attributes method to update
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 |