search for: find_products_for_sale

Displaying 6 results from an estimated 6 matches for "find_products_for_sale".

2008 Jul 10
5
Uninitialized constant (controller/model)
NameError in StoreController#add_to_cart uninitialized constant StoreController::Cart This is the controller: class StoreController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart @cart = find_cart product = Product.find(params[:id]) @cart.add_product(product) end private def find_cart session[:cart] ||= Cart.new end end Amd this is the model class Cart attr_reader :items def initialize @items = [] end def add...
2006 Aug 04
6
Errors ... errors and errors.
...tead of 1. But that should be quite impossible, beacause the cart.rb has a def add_product(product) as we shall see later. I do not understand why it gives me that error. Here is the store_controller.rb: [CODE] class StoreController < ApplicationController def index @products = Product.find_products_for_sale #creates an instance variable that holds a list of all the #products in order to make it available to the code in the view #that will display the table #find_products_for_sale() IS DEFINED IN product.rb end def add_to_cart @cart = find_cart #we use find_cart method to fin...
2006 Jul 27
2
(Agile Rails 2nd ED) Depot App: Iteration B1 500 Error
Hello: I am working through the 2nd Edition of the agile book (after watching the first edition age on my shelf for 6 months), and am having a problem with the newly created ''store'' I''ve checked the files and fucntions that I''ve written, namely: model/product find_products_for_sale controller/store index views/store/index.rhtml and they all seem to have end''s in the right place, as was hinted at in an earlier post. I have also not seen anything in the Errata on the Pragmatic Website. The specific error I''m receiving is: Browser: Application error Chang...
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
2008 Apr 15
2
NoMethodError in StoreController#add_to_cart
...t) @itmes << product debugger end end -------------------------------------------------- The contents of store_controller.rb ------------------------------------------------------------------------------- class StoreController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart @cart = find_cart product = Product.find(params[:id]) @cart.add_product(product) debugger end private def find_cart session[:cart] ||=Cart.new end end --------------------------------------------------------------------------------- What could be the...
2006 Jun 16
8
OffRailed, and stuck in the book : (
...t;/ul> --------------------------------------------------------------------- I''ve checked my store_controller.rb and it is just copied and pasted: ********************************************************** class StoreController < ApplicationController def index @products = Product.find_products_for_sale @page_title = "We Welcome you" end def add_to_cart @cart = find_cart @product = Product.find(params[:id]) @cart.add_product(@product) end private def find_cart session[:cart] ||= Cart.new end end ************************************************************ I''ve looked at my m...