This is what I have got.Will appreciate it if you can go through this and amend.Note the method highlighted.
class InteractController < ApplicationController def index �...@products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id])�...@cart = find_cart �...@cart.add_product(product) rescue ActiveRecord::RecordNotFound logger.error("Attempt to access invalid product #{params[:id]}") flash[:notice] = "Invalid product" redirect_to :action => 'index'end def empty_cart session[:cart] = nil flash[:notice] = " Now,your cart is currently empty" redirect_to :action => 'index'end private def redirect_to_index(msg) flash[:notice] = msg redirect_to :action => 'index' end end Regards and Respects, Kindness in thought leads to wisdom. Kindness in speech leads to eloquence. Kindness in action leads to love. --- On Sun, 12/13/09, Susan McM. Tucker <smtuc...@prettycoolsolutions.com> wrote: From: Susan McM. Tucker <smtuc...@prettycoolsolutions.com> Subject: Re: [Rails] Need help...NameError in InteractController#add_to_cart To: rubyonrails-talk@googlegroups.com Date: Sunday, December 13, 2009, 10:48 AM Though I have only been playing with Rails for about a month, I think I can answer this one. You need to define add_a_cart in the store_controller.rb. Good luck. *susan* > 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_cart > undefined local variable or method `find_cart' for > #<InteractController:0x1042d0780> > RAILS_ROOT: > /Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritageApplicatio > n Trace < -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.