Displaying 20 results from an estimated 1000 matches similar to: "Rails - depot application"
2006 Aug 15
3
update or alter cart
I want to modify and update the items in the Depot - "display_cart".
Since the cart is in a session, its a little hard to get at the data.
I just want to create a way to change quantities, prices and
recalculate.
Has someone done this, and could you point me to the right direction.
Thanks
Chas
--
Posted via http://www.ruby-forum.com/.
2007 Oct 19
14
Agile Web Development Book, need a bit of help
I''m working my way through the book Agile Web Development with Rails,
and I am in the section where the book has me creating a display_cart
method and the associated view. When I copied the code from the book
into the view, it threw this error. If anyone could give me some hints
where I should be looking I''d appreciate it.
NoMethodError in Store#display_cart
Showing
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 Aug 02
7
Same error ... again.
I reached page 82 of the Book "Agile Development with Rails" First
Edition. After I compiled the code I got the following error message.
[CODE]
NoMethodError in Store#display_cart
Showing app/views/store/display_cart.rhtml where line #11 raised:
undefined method `product'' for 1099.0:Float
8: <table>
9: <%
10: for item in @items
11: product = item.product
12:
2006 Mar 05
3
"Undefined method" problem in "Agile Web Development With Rails"
Hi,
I''m reading the "Agile Web Development With Rails" book. So long,
everything has worked fine, but now I got this annoying error message
that I just can''t understand. The error appears for me around page
87, chapter 8.
NoMethodError in Store#display_cart
Showing app/views/store/display_cart.rhtml where line #28 raised:
undefined method `product''
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 Jan 19
3
Troubleshooting Depot App
Hello! I am working my way through the Agile Web Development guide on
RoR (the depot application).
I am a bit lost as to where to debug the following error. The error is
pasted below:
================================================================================================
NameError in Store#add_to_cart
undefined local variable or method `product'' for LineItem:Class
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 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
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 Feb 27
1
Odd problem in Agile tutorial
I am getting an undefined method error in my cart.rb class when trying
to find in an array. I cannot see what my error is. Perhaps a view
more eyes can help me with this:
#---------------------------------------------------------------
1 class Cart
2
3 attr_reader :items
4 attr_reader :total_price
5
6 def initialize
7 @items = []
8
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 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
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:
--
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 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 Apr 24
3
Form with multiple rows of content
I have looked at examples for this. I found a similar example in the
Agile Web Dev... book but that didn''t help. Here''s what i am trying to
do.
A Cart has many line items. On the Display Cart page, I want to provide
the user the option to update quantities.
Here''s the rhtml code:
<%= start_form_tag :action => ''update_cart'' %>
2005 Dec 23
6
Agile book - test error
Hi all,
I get an error when testing the "store_controller_test.rb"
The troublesome line is in the test below:
def test_add_to_cart
get :add_to_cart, :id => @version_control_book.id <<<
cart = session[:cart]
assert_equal @version_control_book.price, cart.total_price
assert_redirected_to :action => ''display_cart''
follow_redirect
2006 May 19
3
new to rails; problem with testing section in Agile book
Hello, I should give the expected disclaimer that I am brand new to
rails and am going through the Agile web development with Rails book
right now. I am in the testing section and I can''t get past an error.
this is my cart_test.rb test file:
require File.dirname(__FILE__) + ''/../test_helper''
class CartTest < Test::Unit::TestCase
fixtures :products
def setup