2
2

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 1 year has passed since last update.

【Rails】redirect_backとは

Last updated at Posted at 2022-01-05

redirect_backを使うと、直前のページにリダイレクトをしてくれる。

使い方.
redirect_back fallback_location: 直前のページに戻れなかった際のパス

#使用例
redirect_back fallback_location: root_path

redirect_backを使う際は、直前のページに戻れなかった際のパスの記述が必要。

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?