Reputation: 21
I am using this to show flash messages in rails
<% if @article.errors.any? %>
<h3>Error!</h3>
<% @article.errors.full_messages.each do |msg| %>
<ul>
<li><%= msg %></li>
</ul>
<%end%>
rails is also showing its generated flashes like
["Description is too short (minimum is 20 characters)"]
on the index page also
Upvotes: 0
Views: 129
Reputation: 4619
From the rails docs:
You can use
flash.discard
flash.discard(:error)
To mark the entire flash or a single flash entry to be discarded by the end of the current action:
Or use
flash.clear
You can find all the methods exposed by rails here.
Upvotes: 0