[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

storing multiple of the same object from a request

(D. Alvarado)

1/30/2008 5:54:00 AM

Hi,

I have this form ...

<% for i in 1 .. 5 %>
<tr><td>
<table>
<tr>
<td><%= text_field("ec_line_item", "prescription_number",
"index" => i) %></td>
<td><%= text_field("ec_line_item", "description", "index"
=> i) %></td>
</tr>
<tr>
<td align="center">Prescription Number</td>
<td align="center">Description</td>
</tr>
</table>
</td></tr>
<% end %>

Now on my controller end I would like to save the objects (each object
is of class "ec_line_item" with attributes "prescription_number" and
"description") but only if the prescription_number attribute is not
empty. What's the most efficient way of doing this?

Thanks, - Dave
1 Answer

Rick DeNatale

1/30/2008 9:57:00 PM

0

On 1/30/08, laredotornado <laredotornado@zipmail.com> wrote:
> Hi,
>
> I have this form ...
>
> <% for i in 1 .. 5 %>
> <tr><td>
> <table>
> <tr>
> <td><%= text_field("ec_line_item", "prescription_number",
> "index" => i) %></td>
> <td><%= text_field("ec_line_item", "description", "index"
> => i) %></td>
> </tr>
> <tr>
> <td align="center">Prescription Number</td>
> <td align="center">Description</td>
> </tr>
> </table>
> </td></tr>
> <% end %>
>
> Now on my controller end I would like to save the objects (each object
> is of class "ec_line_item" with attributes "prescription_number" and
> "description") but only if the prescription_number attribute is not
> empty. What's the most efficient way of doing this?

First, this is really a question for the rails group.
http://groups.google.com/group/rubyonrails-t...

That said, you should check out Ryan Bates series of 3 RailsCasts starting with:
http://railscasts.com/e...

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...