Jazib Bashir
Jazib Bashir

Reputation: 503

Flash Message Error in Rails app?

IN my rails application flash message is visible but without its proper blocks and colors. falsh message "Invalid data double check your field"

enter image description here

I successfully add bootstrap-sass gem in my gem file. and run bundle install.

Code of flash message .

<% flash.each do |key, value| %>
        <div  class="alert alert-<%= key%>">
        <%= value %></div>
      <% end %> 

Code of Calling flash hash

flash[:error] = 'Invalid Data Double Check Your Field'

i also require file properly

*= require bootstrap
//= require bootstrap

Now how i solve this error?????

Upvotes: 1

Views: 235

Answers (1)

Surya
Surya

Reputation: 16002

Because there's no alert-error CSS class in bootstrap. It should be alert-danger.

If you want, then you can refer to this article for managing flash messages using Twitter Bootstrap. Note that your application doesn't have to be on Rails 4 and using twitter-bootstrap 3(as mentioned in the article), but you can use the same approach to suit your requirement.

Upvotes: 3

Related Questions