Displaying 1 result from an estimated 1 matches for "cart_empty".
2006 Sep 03
2
Undefined method "xxx" of a model when calling a helper
...nd
def empty!
initialize
end
def empty?
return true if @line_items.empty?
false
end
end
And I have some helper methods in application_helper.rb:
module ApplicationHelper
def find_cart
session[:cart] ||= Cart.new
end
def empty_cart
find_cart.empty!
end
def cart_empty?
return true if find_cart.empty?
end
end
Then I want to display a partial form within the layout
application.rhtml but only if the cart is not empty:
<%= render(:partial => ''warenkorb/warenkorb'', :locals => {:cart =>
find_cart}) unless cart_empty? %>
But...