similar to: Odd problem in Agile tutorial

Displaying 20 results from an estimated 1000 matches similar to: "Odd problem in Agile tutorial"

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
2007 Aug 30
3
Rails - depot application
I''m doing the depot example in the Agle Web development book. I''m getting this error: "undefined method `product'' for #<BigDecimal:331ce70,''0.21E1'',8(8)> " "Extracted source (around line #9): 8: for item in @items 9: product = item.product 10: -%> 11: <tr> 12: <td><%= item.product%></td>"
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 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 Jan 25
2
Agile tutorial
Thank you for the comments on conditional replacements. I now have another oddity to deal with. When adding products to the session cart I am not able to have the count incremented if the product has already been selected, rather another item is added to the cart. I copied the code from the book as carefully as I could and could find no error but to be sure I then cut and pasted the code
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 Feb 01
1
Problems with sample code from "agile webdev. w. rails"
Hello, I am veeeery new to rails and also to ruby. I have 2 books here on my desk and try to go through it. The first book is "Agile Webdevelopment with Rails" and I have trouble with the following code which I have from the book. I cant get it working. I searched a lot on google - and also on the erata pages of the book publisher but without any luck. I hope someone can help me.
2006 Jan 05
0
question about Agile Rails
anyone can explain me why in the Agile Depot Tutorial application they use i.product_id to find if a product already exist in the cart, because the cart contains items which each of them reference a product. I tried i.product_id like in the tutorial and i.product.i all of these 2 notation works , but i find the second s more clean. Any explanation will be fine Regards def
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 Dec 07
2
Problem saving parent and children using belongs_to, class_name, and foreign_key
Hi, I have a real simple association setup here that''s just trying to: - Create a new PayjunctionOrder - Create some LineItem objects and assign them to the PayjunctionOrder - Save everything I''m using Rails Edge. ---- class PayjunctionOrder < ActiveRecord::Base has_many :line_items end ------------------ ---- class LineItem < ActiveRecord::Base belongs_to :order,
2006 Aug 07
0
Re:
>From: Josh Kieschnick <jjkiesch@...> >Subject: Re: "Undefined method" problem in "Agile Web Development Wit >Newsgroups: gmane.comp.lang.ruby.rails >Date: 2006-03-22 04:39:56 GMT (19 weeks, 4 days, 23 hours and 8 minutes ago) >I am working through that book as well. I am getting the exact same >error. I thought it was something I did wrong but I have no
2006 Aug 12
0
insert into database failing
hi all, i am trying a little project based on the agile book''s shopping cart example and have hit a problem. the inserts are failing when saving a quote which contains line_items. the models are as follows (quote_line_item is using single table inheritance): class Quote < ActiveRecord::Base has_many :quote_line_items end class LineItem < ActiveRecord::Base end class
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 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
2006 Jan 15
6
Saving one-many associations (elegant solution please)
What is the most elegant way to save new one-many associations? order = Order.new(:name => "My Order") order.line_items << LineItem.new(:product_id => 1, :quantity => 2) order.line_items << LineItem.new(:product_id => 2, :quantity => 5) order.save The above - which is by far the most elegant way of putting it - doesn''t work for me - the line_items
2013 Sep 23
1
redirect on browser success, but redirect on functional test is error
line_items.yml: one: product_id: 1 cart_id: 1 quantity: 1 carts.yml: one: {} product.rb: has_many :line_items cart.rb: has_many :line_items, dependent: :destroy line_item.rb: belongs_to :product belongs_to :cart line_item_controller.rb: def destroy @line_item = LineItem.find(params[:id]) @cart = @line_item.cart @line_item.destroy respond_to do |format| format.html
2006 Mar 01
2
active_record postgresql adapter problem
Instead of using numeric I created the field "unit_price" as PostgreSQL type money. Now when I try and add a row I get the following. How do I override AR default behaviour to cast numeric post data to money, or am I forced to only support database types that active_record knows about? RuntimeError: ERROR C42804 Mcolumn "unit_price" is of type money but expression is of
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/.