From 53c2598c48f7fde9052b1917e8c1a5307c95297f Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 12 Oct 2014 20:44:55 +0200 Subject: [PATCH] Only display flash notifications for :alert and :notice keys --- app/helpers/application_helper.rb | 4 ++++ app/views/shared/_flash.html.slim | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6dab913..db046da 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -73,4 +73,8 @@ module ApplicationHelper Theme::AVAILABLE.invert end + def flash_notifications + flash.select { |type, _| [:notice, :alert].include?(type.to_sym) } + end + end diff --git a/app/views/shared/_flash.html.slim b/app/views/shared/_flash.html.slim index a95e873..8f723e7 100644 --- a/app/views/shared/_flash.html.slim +++ b/app/views/shared/_flash.html.slim @@ -1,3 +1,3 @@ -- flash.each do |type, message| +- flash_notifications.each do |type, message| section.flash[class=type] .container = message