Skip to content

Commit bc9a4c5

Browse files
authored
Merge pull request rails#41493 from radar/redirect-back
Add redirect_back directive to Rails 5.0 -> 5.1 upgrade guide
2 parents 90049a4 + c9955d3 commit bc9a4c5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

guides/source/upgrading_ruby_on_rails.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,24 @@ Rails.application.secrets[:smtp_settings][:address]
710710

711711
### Removed deprecated support to `:text` and `:nothing` in `render`
712712

713-
If your views are using `render :text`, they will no longer work. The new method
713+
If your controllers are using `render :text`, they will no longer work. The new method
714714
of rendering text with MIME type of `text/plain` is to use `render :plain`.
715715

716716
Similarly, `render :nothing` is also removed and you should use the `head` method
717717
to send responses that contain only headers. For example, `head :ok` sends a
718718
200 response with no body to render.
719719

720+
### Removed deprecated support of `redirect_to :back`
721+
722+
In Rails 5.0, `redirect_to :back` was deprecated. In Rails 5.1, it was removed completely.
723+
724+
As an alternative, use `redirect_back`. It's important to note that `redirect_back` also takes
725+
a `fallback_location` option which will be used in case the `HTTP_REFERER` is missing.
726+
727+
```
728+
redirect_back(fallback_location: root_path)
729+
```
730+
720731

721732
Upgrading from Rails 4.2 to Rails 5.0
722733
-------------------------------------

0 commit comments

Comments
 (0)