In rails 5 you can use add_flash_types
method. Just add it to ApplicationController and include the types you want:
# application_controller.rb
...
add_flash_types :success, :warning, :danger, :info
on your controller use the appropriate type instead of 'notice':
redirect_to @ticket, success: 'Ticket was successfully created.'
and then you can automate your view:
# application.html.erb
...
<% flash.each do |message_type, message| %>
<div class="alert alert-<%= message_type %>">
<%= message %>
<button class="close" data-dismiss="alert">×</button>
</div>
<% end %>