1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

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