<% flash.each do |k, v| %> <% next unless %w(success danger warning info).include?(k.to_s) %> <% end %> <% flash.now.as_json.each do |k, v| %> <% next unless %w(success danger warning info).include?(k.to_s) %> <% end %>