rails5 deviseでのサインアップ等の処理の後にフラッシュメッセージを表示する
application.html.haml
!!! %html %head %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/ %title ChatSpaceV3 = csrf_meta_tags = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' = javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %body <b> - flash.each do |key, value| - key = "info" if key == "notice" - key = "danger" if key == "alert" = content_tag :div, value, class: "alert alert-#{key}"</b> = yield
content_tagについて
content_tag - リファレンス - - Railsドキュメント
flashmessage.scss
.alert-info { background-color: #e0f0d9; color: #3e753f; } .alert-danger { background-color: #f2dede; color: #a94442; }
メッセージに色を入れる