1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

renderとredirect_toの違い

Posted at

render

次に指定するViewを指定している。
今持っている変数で新しいViewを構成する。

redirect_to

次に指定するメソッドを指定している。
ブラウザに対して指定したメソッドにHTTPリクエストを送るように司令する。
リクエストが二回発生してしまうことになる。

例:
=> GET home/show
<= redirect_to
=> Get home/index
<= home/index

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?