1

Building it with rubies on Rails

When devise attempts to log in and it fails it says alert type as (alert)

Am trying to change it to show Danger

GitHub commit changes

I apologize in advance only been doing this for Less 3 to 4 months just looking for some help

My attempt to use a helper class to try to fix the situation the first time

<% flash.each do |type, msg| %>

<% if type === 'alert' %>

<% type = 'danger' %>

<% end %>

<%= content_tag :div, msg, class: "alert alert-#{type}", role:"alert" %>

<% end %>

</div>
  • Possible duplicate of [Rails Devise I18n Flash Messages with Twitter Bootstrap](https://stackoverflow.com/questions/20234504/rails-devise-i18n-flash-messages-with-twitter-bootstrap) – Andrew Myers Dec 14 '17 at 00:31
  • You can use this https://stackoverflow.com/questions/20234504/rails-devise-i18n-flash-messages-with-twitter-bootstrap, but if isnt what you lookin for, please explain better your question. – Elis Bresciani Nov 30 '17 at 16:59
  • Yes that's exactly what I'm looking for. Thanks for your help – user8459218 Nov 30 '17 at 17:21
  • @user8459218 if this answer solved your issue, please consider marking it as accepted. – Brad Werth Dec 01 '17 at 03:01

1 Answers1

0

If I didn't get you wrong, you want to show a Devise alert styled as a Bootstrap alert. Try adding this piece of code to your main layout (it's usually at "app/views/layouts/application.html.erb")

<% if alert != nil%>
  <p class="alert alert-danger"><%= alert %></p>
<%end%>