<%if @error.present?%>
var alertDiv = $('<div class="alert alert-danger"><%= @error[:msg]%></div>')
$("#container").prepend(alertDiv)
setTimeout(function() {
$('.alert').remove();
}, 3000);
<%end%>