mirror of https://github.com/rails/rails
Use instance variables in redirect_to
This commit is contained in:
parent
4ac1a72630
commit
9c18cb1e70
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue