Flash messages in Rails getting carried over to the next page

前端 未结 1 397
既然无缘
既然无缘 2021-02-08 01:50

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|
         


        
1条回答
  •  悲哀的现实
    2021-02-08 02:41

    The way you are displaying the flash messages is fine. I think the problem is how you are setting them. If you are setting flash messages and not redirecting you can assign to flash.now[:notice] instead of flash[:notice], for example, and your message will not hang around after the redirect.

    0 讨论(0)
提交回复
热议问题