Displaying 20 results from an estimated 75 matches for "add_to_cart".
2007 Oct 15
4
ArgumentError in StoreController#add_to_cart: wrong number of arguments (1 for 0)
...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 is all good.
def add_to_cart
@cart = find_cart
product = Product.find(params[:id])
@cart.add_product(product)
end
Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to t...
2005 Sep 02
4
Error has me stumped (Agile Web Dev with Rails book)
...th 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 for the code that I downloaded from the
book''s website.
When I try to add an item to the cart
(http://192.168.1.7:3000/store/add_to_cart/1) I get the following
error:
- -
Unknown action
No action responded to add_to_cart
--
If I try to display the cart instead
(http://192.168.1.7:3000/store/display_cart) I get this:
--
Unknown action
No action responded to display_cart
--
As far as I can see everything I need is in place.
Than...
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 evaluating nil.<<
E:/InstantRails/rails_apps/depot/app/models/cart.rb:9:in `add_product''
E:/InstantRails/rails_apps/depot/app/controllers/store_controlle...
2008 Sep 03
2
Highlighint rjs problem on a new product
...(product) %><% totalCh += cheapest %></td>
</tr>
<% end %>
<table>
-------------------------------------------
Form Code:
--------------------------------------------
<% form_remote_tag :url => {:controller => "sgpanel", :action =>
"add_to_cart", :ad => params[:id] , :bd => groceries.id } do %>
<%= submit_tag "Add to Cart" %>
<% end %>
---------------------------------------------
Controller Code:
def add_to_cart
@sguser = Sguser.find(params[:ad])
@lineprice = SglineItem.find(:all, :conditions...
2006 Apr 18
4
''depot'' tutorial failing on adding to cart
.... 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:
--
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 occured while evaluating nil.<<
--
I''ve been testing in Firefox to ensure that the cookie is being
created (it appears to be OK). Does anyone know what I''m m...
2006 Jul 27
1
form_remote_tag
How can I get a name/id for a form using the remote form tag?
<%= form_remote_tag :url => { :action => :add_to_cart, :id => timecard }
%>
gives me:
<form action="/timecard/add_to_cart/4"
method="post"
onsubmit="new Ajax.Request(''/timecard/add_to_cart/4'',
{asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)});...
2006 May 09
2
name and class href attribute in a link_to_remote
...me out like this:
<a href="action" onclick"ajax(action)" name="Title Of Link"
class="someclass">
So far the link looks like this:
<% for course in @courses %>
<%= link_to_remote "#{course.title}",
{:url => {:action => "add_to_cart", :id => course},
:complete => visual_effect(:highlight, "schedule", :duration =>
1.5)},
{:href => url_for(:action => :add_to_cart, :id => course )} %>
<% end %>
Thanks.
--
Posted via http://www.ruby-forum.com/.
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 Trace
app/controllers/customer_controller.rb:36:in `session''
app/controllers/customer_controller.rb:36:in `add_to_cart''
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~...
2006 Mar 22
2
What is wrong in this method??????
Hi,
This is my definition of method "add_to_cart"
=======================
def add_to_cart
count=params[:product][:count]
while count.to_i>=0.to_i
if params[:product][''dem_quantity''+count.to_s]==""
else
@product =
Product.find(params[:product][''product_id''+count....
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 `add_product''
#{RAILS_ROOT}/app/controllers/store_controller.rb:19:in `add_to_cart''
-e:4
Now, it says as far as I understand it, that it should...
2009 Dec 13
20
Need help...NameError in InteractController#add_to_cart
...loping 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 #<InteractController:0x1042d0780>RAILS_ROOT: /Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritageApplication Trace | Framework Trace | Full Trace/Users/oluwayomioluwadara/Documents/CED/coursework/heritage/heritage/app/...
2006 Jan 24
3
Unitialized constant
......
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''
./public/../config/../app/controllers/store_controller.rb:9:in
`add_to_cart''
This error occured while loading the following files:
cart.rb
Any ideas what I did wrong? I can''t find a problem with "find_cart"
or "add_to_cart". My cart.rb class has been created.
Thanks,
Doug
2009 Apr 23
0
NoMethodError in StoreController#add_to_cart
Working through the Agile Web Development w/ Rails book on p114. I can
add single items of each to the cart but when I try to add a second item
I get the following error:
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 evaluating nil.+
Any idea why this is happening? Thanks.
Frank.
--
Posted via http://www.ruby-forum.com/.
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 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 Trace
D:/Ruby/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:939:in
`find_from_ids''
D:/Ruby/InstantRails/ruby/lib/ruby/gems/1....
2008 May 11
2
UnKnownAction exception
Hi all,
i''m new in ruby on rails.
i created a controller which has 2 views index, add_to_cart
& inside index i created "button_to" which references to add_to_cart
view, but when i click on this button UnKnownAction exception appear
to me, i don''t know why this happen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are sub...
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''
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/acti...
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: !ruby/object:Cart
items: []
total_price: 0.0
flash:...
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)...
2006 Feb 26
0
NoMethodError in Agile Web Devleopment Depot Tutorial
...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 Store#add_to_cart
#{RAILS_ROOT}/app/models/cart.rb:10:in `add_product''
#{RAILS_ROOT}/app/controllers/store_controller.rb:11:in `add_to_cart''
Any ideas? Here are various bits of code:
===============================
#store_controller.rb
cl...