I followed the sample code in AWDR 2 like this:
store_helper.rb
def hidden_div_if(conditions, attributes = {}) if conditions attributes["style"] = "display:none" else attr = tag_options(attributes.stringify_keys) "<div #{attr}>" end end
store.html.erb
<%= hidden_div_if(@cart.items.empty?, :id => "cart") %> <%= render(:partial => "cart", :object => @cart) %> </div>
when the cart is empty, the "<div id=... class=...>" snippet is not displayed there.
could anybody help me with this?