【Rails】flashを使う

<% if notice %>
  <div class="alert alert-info role="alert">
    <%= notice %><button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
<% end %>

<% if alert %>
  <div class="alert alert-danger" role="alert">
    <%= alert %><button type="button" class="close" data-dismiss="alert">&times;</button>
  </div>
<% end %>
$(function(){
  setTimeout("$('.alert').fadeOut('slow')", 3000);
});
.alert {
  text-align: center;
  position: fixed;
  width: 100%;
  top: 0;
}