This is what I wrote in a controller file, but only 1 notice (the last one) would appear.
flash[:notice] ="a: " + aa.to_s
flash[:notice] ="b: " + bb.to_s
flash[:notice] ="c: " + cc.to_s
I want to show all of the three notice together (at one time), is there anyway to achieve this?
in my html:
<% if notice %>
<p id="notice"><%= notice %></p>
<% end %>
You could try like this
flash[:notice] = ["a: " + aa.to_s]
flash[:notice] << "b: " + bb.to_s
flash[:notice] << "c: " + cc.to_s
And then in your views, output it as
<%= flash[:notice].join("<br>") %>
or whatever you want in your view
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With