similar to: Errors and Forms with arrays

Displaying 20 results from an estimated 10000 matches similar to: "Errors and Forms with arrays"

2006 Jan 22
0
Forms with multiple item entry
Hello- I was wondering what would be the simplest/cleanest way to have a view offer entry fields for several items (e.g. the "quantity" for items in a shopping cart). If I have a model such as "cart" which has_many "items", then I can use "cart.items" to get an array of all of them. Each item has a quantity, so I''d have
2006 Jan 31
2
Design question: Storing user fields
Hello- I have a database/rails design question. I''d like the user to be able to specify a set of fields they would like associated with items. Imagine a shopping cart where each item has a description and price. But a particular customer may choose to associated a color with all her items. (it will be site-wide, so every item listed for this particular user will have this
2006 Jul 24
1
Newbie error: undefined local variable or method
When I add an item to the shopping cart, I get an error: undefined local variable or method `cart_item'' for #<#<Class:0x3715a78>:0x3715a48> Session info says the cart being updated properly. I''m just not able to output two variables: <%= cart_item.quantity %> &times; <%= h(cart_item.title) %> I did some research, and I can grasp that local
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 Feb 24
0
Depot Application - Adding a Quantity field to the Store
Hello, I''m just getting started with Ruby on Rails. Of course, I bought the "Agile Programming..." book. I went through the shopping cart (depot) tutorial without any problem. However, I would like to change the cart so that one can enter a quantity for each item desired. I''m assuming that each item would need to be converted to include a form with the a hidden field
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
2007 Aug 05
0
Newbie - Question on Parent child updating
All, I''ve just started Rails and Ruby a week or so ago. Please forgive me for my ignorance. I started writing a small test application to test some of my new knowledge and have hit a wall. Would like some best practices. I have 3 tables, as below... CREATE TABLE `carts` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) NOT NULL, `quantity` int(11) NOT NULL, PRIMARY
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'' %>
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 Feb 27
0
Depot - How to change the Store to a Form based application?
Hello, I''m just getting started with Ruby on Rails. Of course, I bought the "Agile Programming..." book. I went through the shopping cart (depot) tutorial without any problem. However, I would like to change the cart so that one can enter a quantity for each item desired. Has anyone else tried to do this? Can anyone point me in the right direction? Thanks! Brad -- Posted
2007 Sep 14
0
deal with Controller and Action logic in RJS?
The question is, should we deal with Controller and Action logic in the RJS file? If so, is it quite "spaghetti-like"? This is actually for the Agile Web book Shopping Cart example: If the user clicks "Remove Item" and we do it the AJAX way, what if we want to first show the cart''s content as 0 x Pragmatic Version Control $0.00 and then highlight
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 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 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 Apr 13
2
Creating multiple option groups
I''m setting up a basic shopping cart type app, and the products we have will have multiple options. Size, color, etc. I''m trying to figure out how I can collect the the options that are selected when a user adds the item to their cart. An OptionSet is a group of options ("Size", "Color", etc), and an ItemOption is the option itself ("12 oz",
2005 Dec 19
8
Simply Ruby question: "zerofill"
Hi there- What''s the easiest/most efficient way to perform a zerofill in Ruby? i.e. Given the value ''val'', I would like to do something like: val = 43 puts val.zerofill(8) ---> "00000043" gsub? sprintf of some sort? Jake -- Posted via http://www.ruby-forum.com/.
2005 Dec 23
0
newbie question
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 Jul 31
4
RJS to find an element
I''m trying to implement a remove from cart method based on the examples in the second edition Agile book. I have everything working except for the RJS that removes items from the cart. Ideally what I''d like to do is highlight an element that I am deleting only if there is more than one of that particular item in the cart. If the item deleted is the only of
2008 Oct 24
4
Railscast 75, Observe_field and Shopping Cart
Hi all, I have the shopping cart page where a user can add items dynamically through ajax as explained in Railscast episode 75. I am using observe_field to observe the ''quantity'' and ''cost'' fields to update the total field for each item. This does not work however, for records that are added through the Ajax. How can i name the fields and observe them as i have
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