I need to be able to do
render 'current page', :notice => 'message'
The notice is lost when using redirect_to
, probably because I'm doing this in active-admin. But it works for render
You can use flash
in this scenario, which saves key-value pairs across web requests:
flash[:notice] => 'message'
redirect_to some_url
Then inside your view for the URL you've redirected to:
<h1><%= flash[:notice] %></h1>
Additional reference: https://api.rubyonrails.org/classes/ActionDispatch/Flash.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.