Reputation: 5497
When my session expired, Devise is giving me a nonsense error like below:
Here's my code:
<% flash.each do |key, value| %>
<div class="alert alert-<%= key %>"><%= value %></div>
<% end %>
How do I customize it so it doesn't show the true
error?
Upvotes: 13
Views: 1274
Reputation: 1200
You could also just check to see if the value is_a?(String) before displaying it.
Upvotes: 8
Reputation: 20643
Yep, it was reported in github devise repo, and they update the readme about that.
I solve it in my app with a code like this:
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div class="alert alert-<%= flash_class(level) %> fade in">
<button type="button" class="close" data-dismiss="alert">X</button>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
Hope it helps.
Upvotes: 11