Question about method "hidden_div_if" in AWDR 2

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) %>

when the cart is empty, the “

” snippet is not
displayed there.

could anybody help me with this?

sorry for the mistake, I didn’t read the sample code carefully.

there’s no “if…else…end” structure in this method. :slight_smile:

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