Hi,
I am displaying error and notice messages in my application with a helper method as shown below.
def display_flash_content
[:error, :notice].map do |key|
collection = flash[key].blank? ? [] : (flash[key].respond_to?(:map) ? flash[key] : [flash[key]])
collection.map {|item| content_tag(:div, item, :class => key.to_s) }
end
end
and my layout has this
<%= display_flash_content %>
I need to display these messages when I do some operation and then redirect to a specific page (this is working fine). But my problem is this flash message persists between pages. It's coming twice between pages where it needs to be cleared immediately once it's displayed to the user.
How to handle this scenario. Please help me!