Displaying 20 results from an estimated 8000 matches similar to: "Problem"
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
2005 Dec 19
1
<% unless params[:context] == :gallery -%> question
I have a template that is called by two different methods. I only want
part of it too show up when it is called from one of the methods. It
always shows up for me. Can someone help to point out my error? Below
is the method that should keep part of the tempate from printing, and
the relevent part of the template.
method:
def gallery
@product_pages,@products = paginate(:products,
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 Jan 20
5
Instance variable?
I''m trying to grab a temporary variable from my view and then pass along
that value to my model
My view code is this:
<td width="40" align="center"><%= text_field ''product'', ''qty_added'',
{:size=>3}
And I''m trying to pass the qty_added variable to my model.
item.quantity = qty_added
It doesn''t seem
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
2009 Feb 18
3
wrong number of arguments (1 for 0)
Hello,
I am new to ruby on rails. When I tried to create a session I am
getting an error, ''wrong number of arguments (1 for 0)'', in my
controller.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArgumentError in CustomerController#add_to_cart
wrong number of arguments (1 for 0)
RAILS_ROOT: /project/bob_shopping
Application Trace | Framework Trace | Full
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 May 05
1
Agile Rails (1st edition), depot TDD "exercise"
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I''ve been working my way through the Agile book and just completed
the depot sample application. I learned quite a bit along the way.
On page 171 we are led through the creation of a test (that fails)
for new code. The new code (a search function) is left as an exercise
for the reader. Well, I think I solved it but I''m not
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
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 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 May 06
1
depot test-driven development exercise
(I posted this yesterday but within 20 minutes my thread was hijacked
so I''m not sure anyone really saw this.)
I''ve been working my way through the Agile book and just completed
the depot sample application. I learned quite a bit along the way.
On page 171 we are led through the creation of a test (that fails)
for new code. The new code (a search function) is left as an
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 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 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
2008 Sep 03
2
Highlighint rjs problem on a new product
Hi,
Problem Summary:
I have been trying to add the highlight effect to my table but
everytime a new record is added the highlighting gives an rjs error.
However when i click the add to cart button on a product that already
exists inside the table, the highlight effect works. Is this because
the partial must only have only one <tr></tr> in it and the <table>
must be on the other
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 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 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 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:
--