Use instance variables in redirect_to

This commit is contained in:
Mikhail Dieterle 2013-04-28 14:36:00 +03:00
parent 4ac1a72630
commit 9c18cb1e70
1 changed files with 4 additions and 4 deletions

View File

@ -534,7 +534,7 @@ def create
@post = Post.new(params[:post])
@post.save
redirect_to post
redirect_to @post
end
```
@ -609,7 +609,7 @@ look like this:
@post = Post.new(params[:post].permit(:title, :text))
@post.save
redirect_to post
redirect_to @post
end
```
@ -763,7 +763,7 @@ def create
@post = Post.new(params[:post].permit(:title, :text))
if @post.save
redirect_to post
redirect_to @post
else
render 'new'
end
@ -900,7 +900,7 @@ def update
@post = Post.find(params[:id])
if @post.update(params[:post].permit(:title, :text))
redirect_to post
redirect_to @post
else
render 'edit'
end