aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/layouts_and_rendering.md
diff options
context:
space:
mode:
authorJuanito Fatas <katehuang0320@gmail.com>2013-11-13 02:33:04 +0800
committerJuanito Fatas <katehuang0320@gmail.com>2013-11-13 02:33:04 +0800
commit825e350faa8efde19f0aa4ecbae1d5749594ddfc (patch)
treeb22160b4efeacf19dfe01bc202cea23e3046da78 /guides/source/layouts_and_rendering.md
parent9c9d4948e428a226a19aa92c17fa6ac5833c2fb8 (diff)
downloadrails-825e350faa8efde19f0aa4ecbae1d5749594ddfc.tar.gz
rails-825e350faa8efde19f0aa4ecbae1d5749594ddfc.tar.bz2
rails-825e350faa8efde19f0aa4ecbae1d5749594ddfc.zip
[ci skip] Fix curl response output and use strong parameters in update action.
Diffstat (limited to 'guides/source/layouts_and_rendering.md')
-rw-r--r--guides/source/layouts_and_rendering.md7
1 files changed, 3 insertions, 4 deletions
diff --git a/guides/source/layouts_and_rendering.md b/guides/source/layouts_and_rendering.md
index b5d66d08ba..c6a3449ace 100644
--- a/guides/source/layouts_and_rendering.md
+++ b/guides/source/layouts_and_rendering.md
@@ -122,8 +122,7 @@ X-Runtime: 0.014297
Set-Cookie: _blog_session=...snip...; path=/; HttpOnly
Cache-Control: no-cache
-
- $
+$
```
We see there is an empty response (no data after the `Cache-Control` line), but the request was successful because Rails has set the response to 200 OK. You can set the `:status` option on render to change this response. Rendering nothing can be useful for Ajax requests where all you want to send back to the browser is an acknowledgment that the request was completed.
@@ -137,7 +136,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(params[:book])
+ if @book.update(book_params)
redirect_to(@book)
else
render "edit"
@@ -152,7 +151,7 @@ If you prefer, you can use a symbol instead of a string to specify the action to
```ruby
def update
@book = Book.find(params[:id])
- if @book.update(params[:book])
+ if @book.update(book_params)
redirect_to(@book)
else
render :edit