Displaying 20 results from an estimated 2000 matches similar to: "NoMethodError in PublicController"
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,
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 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 --->
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
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
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
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless
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
2008 Feb 20
1
text_field_tag - different parameter name
Hi, I have one problem with validation
I am creating e-shop and I have products. This view look like this:
<% for product in @category.products %>
<div class="produktyBox">
<%= product.title %><br />
Price: <br />
<div style="color:red; font-size:large; font-weight:bold; margin-
bottom:5px"><%=
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:
--
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
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 Jun 07
3
trouble wtih webstore schema, handling product variations
Hi Railers,
Does anyone have any guidance on setting up a simple way to handle
product variations (e.g garment size/color)? Initially, I had thought
that I would make a variation model which defined the extra bits, but it
seems quite inflexible especially so if a store were to sell
non-clothing items that also had variants of one flavor or another.
product
has_many variations
title
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] ||=
2005 Dec 25
2
[repost] newbie questions
Hi all,
I''m following the shop example in ''Agile Web Development with Rails''.
I would like to extend the checkout screen, in such a way people can change
the number of items they have selected in there cart.
In my controller I have:
def checkout
@cart = find_cart
@items = @cart.items
if @items.empty?
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 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