Posted By

batamire on 11/14/08


Tagged

textmate flash helper messages


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Rails flash messages helper


 / Published in: Rails
 

  1. #FLASH_TYPES = [:error, :warning, :success, :message]
  2.  
  3. def display_flash(type = nil)
  4. html = ""
  5.  
  6. if type.nil?
  7. FLASH_TYPES.each { |name| html << display_flash(name) }
  8. else
  9. return flash[type].blank? ? "" : "<div class="#{type}"><p>#{flash[type]}</p></div>"
  10. end
  11.  
  12. html
  13. end

Report this snippet  

You need to login to post a comment.