Permalink
Browse files

Using flash_message_set? to shortcut helper method render_flash_messa…

…ges if there are no flash messages.
  • Loading branch information...
1 parent bc04996 commit aa1c92d77bd4e20d4f413ed96b3961eb33c09c0b @eddorre eddorre committed Apr 5, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/flash-message-conductor/view_helpers.rb
View
3 lib/flash-message-conductor/view_helpers.rb
@@ -6,12 +6,13 @@ def render_flash_message(css_class, message = "")
end
def render_flash_messages(div_id = "flash_messages", div_class = "")
+ return unless flash_message_set?
+
div_content = ''
FLASH_MESSAGE_TYPES.each do |key|
div_content << render_flash_message(key.to_s, flash[key]) unless flash[key].blank?
end
- return "" if div_content.blank?
content_tag('div', div_content.html_safe, :id => div_id, :class => div_class)
end
end

0 comments on commit aa1c92d

Please sign in to comment.