app/helpers/bootstrap_flash_helper.rb in twitter-bootstrap-rails-2.2.0 vs app/helpers/bootstrap_flash_helper.rb in twitter-bootstrap-rails-2.2.1
- old
+ new
@@ -1,17 +1,16 @@
-module BootstrapFlashHelper
+module BootstrapFlashHelper
def bootstrap_flash
- flash_messages = []
- flash.each do |type, message|
- # Skip Devise :timeout and :timedout flags
- next if type == :timeout
- next if type == :timedout
- type = :success if type == :notice
- type = :error if type == :alert
- text = content_tag(:div,
- content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
- message, :class => "alert fade in alert-#{type}")
- flash_messages << text if message
- end
- flash_messages.join("\n").html_safe
- end
-end
\ No newline at end of file
+ flash_messages = []
+ flash.each do |type, message|
+ # Skip empty messages, e.g. for devise messages set to nothing in a locale file.
+ next if message.blank?
+ type = :success if type == :notice
+ type = :error if type == :alert
+ text = content_tag(:div,
+ content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
+ message, :class => "alert fade in alert-#{type}")
+ flash_messages << text if message
+ end
+ flash_messages.join("\n").html_safe
+ end
+end