ruby on rails - Remove flash message on refresh of page -


I am planning to log in and I have overwritten my design session controller and the user has the following information Showing the flash message when entering incorrect information using Code to display flash message.

  & lt;% flash.each do | Name, msg & Gt%; & Lt;% = content_tag: section, msg,: id = & gt; "Flash _ # {Name}" ,: Category = & gt; "Flash"%> & Lt;% end% & gt;   

And if the user enters wrong email and password, then it is working fine and showing "invalid email or password" message.

Now even if I refresh the page, that flash message is still visible but I need to delete the flash message if the page is refreshed. Please help me

You can use flash.discard after the display. Probably like:

  & lt;% flash.each do | Name, msg & Gt%; & Lt;% = content_tag: section, msg,: id = & gt; "Flash _ # {Name}" ,: Category = & gt; "Flash"% & gt; & Lt;% free.discard (name)% & gt; & Lt;% end% & gt;   

I have not tested it, so try that it works.

Comments

Popular posts from this blog

python - Writing Greek in matplotlib labels, titles -

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

Pygame memory leak with transform.flip -