Flash always showing after upgrade from 1.2 to 1.4

So I upgraded from the 1.2 version to 1.4 and I only have one issue which I couldn’t find a way to resolve. I had to upgrade it in the old version folder so it can be used as a branch (it would’ve been easier if it was a new folder but oh well).

Basically everything works except for the info/error flash message. It is always showing:

It’s not that it doesn’t work, it can show messages:

My HTML for showing that part is:

<main role="main" class="container">
  <p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
  <p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
  <%= render @view_module, @view_template, assigns %>
</main>

Wrap them in if statements:

<%= if get_flash(@conn, :info) do %>
    <p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
<% end %>
2 Likes

Yeah I guessed I can do it this way but I really don’t know why is it happening… I would guess due to faulty CSS but oh well.

To solve this problem you need to use this:

.alert:empty{
  display:none
}

You put this css rule after you import bootstrap and it should work for me it does.

2 Likes