user001
user001

Reputation: 39

Flash[:warning] not working with redirect

I am using flash[:notice] to display success messages and flash[:warning] to display warning and error messages.

Flash[:notice] is working fine even while redirecting to another page, but flash[:warning] does not work with redirection.

when I check in my view file flash[:warning] is passed as nil.

how to use flash[:warning] with redirect_to ?

Upvotes: 0

Views: 1169

Answers (1)

DeX3
DeX3

Reputation: 5549

You can pass flashes through redirects using

redirect_to 'page/to/redirect/to', :flash => { :error => 'Some error' }

Upvotes: 0

Related Questions