similar to: Need help...NameError in InteractController#add_to_cart

Displaying 20 results from an estimated 1000 matches similar to: "Need help...NameError in InteractController#add_to_cart"

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] ||=
2006 Aug 04
6
Errors ... errors and errors.
I bought the second edition of the ruby on rails, it seems to work fine now, did some adjustments to the code. But now I get a second error and I want to learn to understand to fix them myself. So here is the error. ArgumentError in StoreController#add_to_cart wrong number of arguments (1 for 0) #{RAILS_ROOT}/app/models/cart.rb:15:in `initialize'' #{RAILS_ROOT}/app/models/cart.rb:15:in
2006 Jan 24
3
Unitialized constant
In Agile Web Development with Rails, I get this error when adding a product to my cart: uninitialized constant Cart ... Application Trace: /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/ active_support/dependencies.rb:200:in `const_missing'' ./public/../config/../app/controllers/store_controller.rb:21:in `find_cart''
2006 Apr 16
9
''depot'' app, where''s session?
Many of you probably know the ''depot'' app from the ''Agile Rails development'' book. I have constructed the ''products'' model, the Store-controller, and the ''Cart'' and ''Line Item'' classes. I have told Application-controller about :cart and :line_item: model :cart model :line_item Here''s part of
2007 Oct 15
4
ArgumentError in StoreController#add_to_cart: wrong number of arguments (1 for 0)
I am really new to Ruby and Rails but as you probably see I am trying to get the shopping card working from the book. I am getting this error but I really don''t know what to do. I have looked up several of topics that stated the same problem but as far as I am, nothing has helped me out yet. Is there something wrong with the Product model? This is in the StoreController and I believe it
2006 Apr 18
4
''depot'' tutorial failing on adding to cart
Hi I''m very keen to learn RoR and have been following the Agile Web Development with Rails book (first edition). However, I''ve come across a problem which has had me stumped for days now. After following the instructions up to page 85 I have tried testing the code thus far, as suggested, by adding an item to the cart. But I am getting the following error: --
2006 Jan 11
6
Help -- NoMethodError in
Hi, I am just learing Rails and I am going through the Agile Web Development with Rails book. I am receiving: NoMethodError in Store#add_to_cart undefined method `add_product'' for #<StoreController:0x3764d80> RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full Trace #{RAILS_ROOT}/app/controllers/store_controller.rb:12:in `add_to_cart''
2006 Jul 03
2
Agile Web Dev on Rails - ActiveRecord::RecordNotFound Prob
Hi there I''ve also made a start on the Agile Web Dev using Rails book! I''ve been hit with a problem when hitting the ''Add to Cart'' button - I get the following error message: ActiveRecord::RecordNotFound in StoreController#add_to_cart Couldn''t find Product without an ID RAILS_ROOT: ./script/../config/.. Application Trace | Framework Trace | Full
2006 Jun 23
3
Yet another problem with NoMethodError in Store#display_cart
Hi everybody, I''ve search a lot on google to help me with this one without success. I know that some people had the same problem as I have, but there solutions doesn''t seems to work for me. I''m trying to do the depot example in the AWDwR book. But now I''m stock with a problem that I can''t solve. I get this error: <--- begin error here --->
2009 Apr 24
11
We're sorry, but something went wrong.
Great. I''m in the development environment and that is the error message I get?! What good does that do me? I''m trying to follow along with the examples in AWDWR(3rd.), and I have this method in a store controller: private def find_cart Cart.new end That works fine, except that every request(initiated by clicking on an ''add to cart'' button) will
2006 Aug 07
2
Newbie question about adding product to cart
Hello. I''m using the Agile Web Dev. book 1st Edition and I''m puzzled by the code on pp. 83-84. <%= link_to ''Add to Cart'', {:action => ''add_to_cart'', :id => product }, :class => ''addtocart'' %> def add_to_cart product = Product.find(params[:id]) @cart = find_cart
2006 Aug 13
3
Logging in Rails
This is a newbie question, I have a class which is not derived from ActionController or ActiveRecord but I want to use logging, I tried require but still logging does not work - This class is located in a file in "model" directory. ------------------------------------ require ''logger'' class Cart def add_product(product) logger.info("Searching for product
2006 Apr 11
2
Extending Depot Example
Hi I am new to the whole Rails/Ruby world as having come from a MS .NET background, but I have followed the Depot example in the Agile Web Dev. with Rails book with relative ease. However as an exercise to see how much I had understood, I thought I would attempt to modify the example a bit and add a Quantity field to the store index so as to pass that value into the cart. I have extended the
2005 Dec 14
9
Passing quantity in a shopping cart
I am using this line on my index.rhtml page to capture the quantity required of a particular item for a basic shopping cart app: <%= text_field ''line_item'', ''quantity'', {:size=>3} %> </td> but my next screen (a cart screen) doesn''t reflect what was entered in that text field when the item is added to the cart. That is,
2007 Oct 19
14
Agile Web Development Book, need a bit of help
I''m working my way through the book Agile Web Development with Rails, and I am in the section where the book has me creating a display_cart method and the associated view. When I copied the code from the book into the view, it threw this error. If anyone could give me some hints where I should be looking I''d appreciate it. NoMethodError in Store#display_cart Showing
2006 Jun 08
19
Agile Web Dev (book) question: errors
This is kind of frustrating (but no doubt helpful in the long run) that after following along and coding , and d/l the code the same error is appearing. For those who are familiar with the depot app, I''ve run into a problem after fixing the cart to reflect quanitites. I worked through the intended error messages but now have this appearing: SyntaxError in StoreController#add_to_cart
2010 Jun 20
1
NoMethodError in StoreController#add_to_cart -> getting nil
Hey everybody, I am currently following the depot application from the book Web Agile Development with Rails (3rd Edition) but after creating the controller for the Store and the Cart model, I am always getting a nil product, no matter how many products I add to the database. I am very new with RoR (this only the page 110 of the book) and thus I am not very sure about what I could do to mitigate
2006 Jul 24
1
Newbie error: undefined local variable or method
When I add an item to the shopping cart, I get an error: undefined local variable or method `cart_item'' for #<#<Class:0x3715a78>:0x3715a48> Session info says the cart being updated properly. I''m just not able to output two variables: <%= cart_item.quantity %> &times; <%= h(cart_item.title) %> I did some research, and I can grasp that local
2006 Jul 18
15
Agile Web Developement with Rails
I recently got a copy of the second addition in PDF and got stuck on the Ajax portion using highlighting page 128. While trying to make my cart flash I got an RJS error when I click add to cart. I have gone back and made sure my code matched what was in the book but no help. I sent Dave an email and he rec''d this list. Anybody got any good links for troubleshooting Ajax or maybe have see
2009 Nov 01
5
Headache with sessions being shared.
I have a really horrendous problem with sessions. before_filter :find_cart_from_session private def find_cart_from_session if session[:cart] # if there''s is a cart in the session begin @cart = Cart.find(session[:cart]) # return existing or new cart rescue ActiveRecord::RecordNotFound @cart = Cart.create @cart.save session[:cart] = @cart.id