Devise 3.5.x on Rails 4.2.x timeout prints "true" under flash timeout message

We have the "timeoutable" option set to Devise 3.5.x in our Rails 4.2 project. When a user is disconnected due to inactivity, they are redirected to the signed page and the following messages are printed:

Your session expired. Please sign in again to continue.
true

      

The unwanted "true" flag under the flag "Your session has expired ..." appears to be the result of a partial flash:

<% flash.each do |key, value| %>
    <% if !value.to_s.empty? %>
        <%= content_tag(:div, value, :class => "flash #{key}") %>
    <% end %>
<% end %> 

      

We drew our attention to the fact that this may not be the optimal way to iterate through the Flash messages. Whenever we manually set flash messages, we always use flash [: notice] or flash.now [: notice] (on render). Is there a better way to iterate through flash messages in our partial that will eliminate this extra "true" output during development timeout? If this is the case, since we are not sure which "types" of flash messages can be used by different gems such as Devise, then what are all types of flash messages ([: notice], [: error], [: warning]), we should check and iterate?

Otherwise, since all of the other Flash messages on the site are working correctly, is there any known way to simply prevent Devise from printing this extra "true" on timeout?

+3


source to share


1 answer


I know this is a late answer, but this is what I did.



flash.each do |msg_type, message|
  unless msg_type.to_s == 'timedout'
  <!-- Carry on printing messages -->

      

+2


source







All Articles