T
Taneal Bhandari
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,
: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!
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,
: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!