Incrementing field through a link

I’m still new to Ruby, so am having issues even beginning to deal with
this. Tried doing some searches, but nothing turned up, and none of the
tutorials that I ran through covered this. Anyway here’s my issue, we
have a form that has a list of items. The last column in this form is a
column (text field) for “quantity”. What I need to do is add a link to
the side of this text field so that when someone clicks on it, it
updates the quantity by 1. I already have a method to display this
page, and another method to perform an update on it. However, I’m
guessing (correct me if I’m wrong) I need to create a new method and
access it by placing a link next to this text field. Here’s my text
field code:

<%= text_field_tag “order_item” + i.to_s + “[quantity]”, @quantities[i],
:size => 3, :maxlength => 2 %>
<%= link_to ‘Add +’, :action => “add_one” %>

What I was thinking I had to do is make my “add_one” method a
combination of my “edit” and “update” methods. It doesn’t seem like
this is the correct way of doing it, but I can’t think of anything else.
Any suggestions? Thanks!

On Wednesday 01 April 2009 17:10:15 Taneal Bhandari wrote:

I’m still new to Ruby, so am having issues even beginning to deal with
this. Tried doing some searches, but nothing turned up, and none of the
tutorials that I ran through covered this. Anyway here’s my issue, we
have a form that has a list of items. The last column in this form is a
column (text field) for “quantity”.

Ruby does not have forms, items, or columns on its own. You probably
want to
ask the Rails list.

In the meantime, I’m going to suggest that you’re generating the link
just
fine, now you need to actually implement that action.

Cool. Thanks. Yeah, such a noob, didn’t even realize that I wasn’t
posting in the appropriate forum. Thanks though.

Yeah, I think I kinda figured it out. Just realized that I can pass
variable information through the link_to method. That should work.