Wednesday, April 29, 2009

Flash Messages, System Messages, Ruby on Rails, by style, debug and test

controller:

flash[:notice] = "Correct things."
flash[:error] = "Alert things."
flash[:debug] = "Simple debug."


views/layouts:

<%- flash.each do |name, msg| -%>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<%- end -%>


css out of dev, in test, this can help you in both environments:

#debug{
display:none;
}

No comments: