diff --git a/app/views/administrate/application/_flashes.html.erb b/app/views/administrate/application/_flashes.html.erb
index 61de271183..6a7be078a0 100644
--- a/app/views/administrate/application/_flashes.html.erb
+++ b/app/views/administrate/application/_flashes.html.erb
@@ -14,6 +14,7 @@ This partial renders flash messages on every page.
<% if flash.any? %>
<% flash.each do |key, value| -%>
+ <% next unless value.respond_to?(:html_safe) %>
<%= value.html_safe %>
<% end -%>
diff --git a/spec/example_app/app/views/application/_flashes.html.erb b/spec/example_app/app/views/application/_flashes.html.erb
index fd9c3ccd13..ed9fc406d3 100644
--- a/spec/example_app/app/views/application/_flashes.html.erb
+++ b/spec/example_app/app/views/application/_flashes.html.erb
@@ -1,7 +1,7 @@
<% if flash.any? %>
<% flash.each do |key, value| -%>
-
<%= value %>
+
<%= value.html_safe %>
<% end -%>
<% end %>