search for: empty_cart

Displaying 5 results from an estimated 5 matches for "empty_cart".

2007 May 30
2
Depot - empty_cart with ajax
...e "empty cart" button, and it didnt update my sidebar. It reloaded the whole page! The I decided to implement the empty cart button with Ajax. Here''s what i did: 1) In "_cart.rhtml" partial, I replaced the line: <%= button_to "Empty cart" , :action => :empty_cart %> with: <% form_remote_tag :url => { :action => :empty_cart } do %> <%= submit_tag "Empty Cart" %> <% end %> After that, i tried everything that "seemed" ok in order to have the page reload the cart without refreshing the whole page, but all i go...
2008 Apr 25
2
Can't Understand Why This Works
I have 3 methods: def add_to_cart # do some stuff redirect_to_index end def empty_cart # do some stuff redirect_to_index("your cart was emptied") end def redirect_to_index(msg = nil) flash[:notice] = msg if msg redirect_to :action => :index end How come the flash notice works if I''m setting msg = nil? For example, if I''m in empty_cart and...
2009 Dec 13
20
Need help...NameError in InteractController#add_to_cart
Hi,I am developing a web app and am following the text-Agile web development.....Each time I click my "add to cart" button" i always get the  page below:I have double checked to see if i have errors in my code,there was none,please what do i need to do to proceed? NameError in InteractController#add_to_cartundefined local variable or method `find_cart'' for
2006 Sep 03
2
Undefined method "xxx" of a model when calling a helper
...nd def initialize @line_items = [] end 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 =&gt...
2006 Jul 16
17
AWDWR question
In an early section on Action View, showing code being put directly into the rhtml file: <% require ''date'' DAY_NAMES = %w{ Sunday Monday Tuesday Wednesday Thursday Friday Saturday } today = Date.today %> <h1>Hello, Dave</h1> <p> It''s <%= DAY_NAMES[today.wday] %>. Tomorrow is <%= DAY_NAMES[(today + 1).wday %>. </p> I get this