Some references about the flash messages:
http://guides.rubyonrails.org/action_controller_overview.html#the-flash
http://railsapps.github.io/rails-default-application-layout.html
e.g.: https://gist.github.com/potomak/1600856