We Recommend

The Rails Way The Rails Way
Now, for the first time, there’s a comprehensive, authoritative guide to building production-quality software with Rails. Pioneering Rails developer Obie Fernandez and a team of experts illuminate the entire Rails API, along with the Ruby idioms, design approaches, libraries, and plug-ins that make Rails so valuable.


Posted By

batamire on 11/14/08


Tagged

textmate flash helper messages


Versions (?)


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.