similar to: wrong number of arguments (1 for 0)

Displaying 20 results from an estimated 2000 matches similar to: "wrong number of arguments (1 for 0)"

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
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
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 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 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 25
1
Agile arguement error
Working my way through chapter 8 of "Agile Web Development...", I''m getting the following error when clicking the add_to_cart button. ArgumentError in Store#add_to_cart wrong number of arguments (0 for 1) What am I doing wrong? I know it''s got to be some thing stupid. Request: Parameters: {"id"=>"1"} session dump: --- :cart:
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 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
2007 Feb 07
1
The Depot "Add to Cart" sessions question (2.ed agile book)
Hello, Im in the process of working my way through the 2.ed of the agile book. As many of you already know, the book goes through the regular development cycle of the Depot application. I have hit a wall when they started talking about the sessions and the exact mechanics of how an item is added to the session. The code looks like this: depot/app/controllers/store_controller: def add_to_cart
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 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
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 Mar 17
1
How to update values in database in this form?
Hi, This is my rHtml page & Corresponding actions & model pages:- ===listform.rHtml================= <h1>Products List</h1> <%= start_form_tag(:action => "add_to_cart")%> <table> <tr> <% i=0 %> <th> Product No. </th> <th> Unit Price </th> <th> Available Qty. </th> <th> Demand Qty. </th>
2009 Apr 06
11
How do I fix this? Power went down.
I was successful in reaching page 184 in the book "Agile Web Development with Rails" 3rd edition and while running the website with PostGreSQL as the backend, the power went down. The PostGreSQL database contents look OK and so do the source code files I was editing. But whenever I click on any "Add To Cart" button in the catalog, I get the following information in the
2006 May 25
7
Grouping controllers
I''m grouping controllers to avoid cluttering the top-level namespace. First, I used script/generate Admin::Customers new edit show list and then I used script/generate Admin::Providers new edit show list. The generator created the subfolders correctly: I have an admin folder and inside there''s customer_controller.rb and provider_controller.rb. I have the same structure in
2006 Jan 10
5
using dynamic element ids with visual_effect
Mike and I demo an Ajaxified version of the Depot application in the Rails Studio. Part of the demo is a cart in the sidebar which updates when you add a product to it. As well as updating the div, it also highlights the most recently added link item. Right now, we do it with: <script language="JavaScript"> function flash_cart(request) { var id =
2005 Aug 04
7
Frames within rails
What is the best way to create frames in rails? thanks fp
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
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