From 558336ee2afad116077df07b5b963077ac5f5021 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 25 Feb 2017 16:55:07 +0000 Subject: Commit flash changes when using a redirect route. In ca324a0 the flash middleware was effectively removed by its constructor returning the app it was passed and the `commit_flash` call was moved to the `ActionController::Metal#dispatch` method. This broke any redirect routes that modified the flash because the redirect happens before `dispatch` gets called. To fix it, this commit adds a `commit_flash` call in the `serve` method of `ActionDispatch::Routing::Redirect`. Fixes #27992. --- actionpack/lib/action_dispatch/routing/redirection.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/redirection.rb b/actionpack/lib/action_dispatch/routing/redirection.rb index dabc045007..e8f47b8640 100644 --- a/actionpack/lib/action_dispatch/routing/redirection.rb +++ b/actionpack/lib/action_dispatch/routing/redirection.rb @@ -36,6 +36,8 @@ module ActionDispatch uri.host ||= req.host uri.port ||= req.port unless req.standard_port? + req.commit_flash + body = %(You are being redirected.) headers = { -- cgit v1.2.3