I had the same problem with the following code:
redirect_to(docs_path, :warning => "I am here!!!") and return if @doc.nil?
using ': notice' and ': alert' instead of ': warning' works as expected. It seems that you can set: notification and: notification directly in the redirect method, but not: error and: warning.
Testing for flash [: warning] .nil? the next step is true, but flash [: notice] .nil? (i.e.: warning flash not installed, but installed: notification).
To get around this, I set the flash [: warning] value before redirecting like this:
if @doc.nil? flash[:warning] = "I am here!!!" redirect_to(docs_path) and return end
It is not so elegant, but it works!
source share