Displaying 20 results from an estimated 1000 matches similar to: "Unitialized constant"
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 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
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 --->
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 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 Feb 12
0
no method error - you have a nil object....
hi,
i''ve been cracking my head on this one for a while and would be humbly
grateful for any pointers
i''m working through Agile Web Devopment w Rails and, in the depot
example have created the cart class for session handling, but am getting
the following error, which suggests the @items variable is not being
populated with any data from LineItem
NoMethodError (You have a
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 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
I''m working on building the shopping cart in the Depot tutorial in the
Agile Web Development book. I''m at the part (about page 80) where you
build the ability to add items to the cart. I''m able to get to
/store/display_cart/ and it seems items are being added, but if I just
click on a link to add an item (/store/add_to_cart/2) it gives me this:
NoMethodError in
2006 Jan 30
2
Cannot see what I have done wrong.
In the Agile Rails tutorial I am revisiting building a cart. I have
followed the steps given in the book to create the class ''Cart''
thus:
class Cart
attr_reader :items
attr_reader :total_price
def add_product(product)
@items << LineItem.for_product(product)
@total_price += product.price
end
def initialize
@items = []
@total_price = 0.0
end
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 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
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 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:
2006 Apr 18
1
''depot''app, trouble with session / cookies
Many of you probably know the ''depot'' app from the ''Agile Rails
development'' book.
When the view changes from ''Store'' to ''display_cart,'' a session
containing the shopping-cart (:cart) is supposed maintain the ''cart''
between calls, but when the display_cart stub view shows up, I have
always ZERO elements
2008 Apr 15
2
NoMethodError in StoreController#add_to_cart
I''m trying to set up the Depot app from Agile Web Development and I
got this error after C1 - Creating a Cart.
The exact error looks like this:
-------------------------------------------------------------------
NoMethodError in StoreController#add_to_cart
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while
2005 Sep 02
4
Error has me stumped (Agile Web Dev with Rails book)
Hello everyone,
I''m a complete Rails newbie who is currently working my way through
the Agile Web Dev with Rails book. I''ve reached the chapter on
creating the shopping cart (chapter 8).
I keep having a problem with the same error which I can''t get past,
however what''s more confusing is that it''s being generated even when I
swap all my app code out
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 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
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