Editing collections

Hi,

I spent all of last night trying to figure out how to edit a list of
objects. According to the Rails book the view should look like this:

view:
<% for @transaction_detail in @transaction_details %>

<%= select 'transaction_detail[]', 'account_id', Account.find_all.collect {|p| [ p.path_name, p.id ] }, {:include_blank => true}, {:class => 'accountList'} %> <%= text_field 'transaction_detail[]', 'quantity', :class => 'qty' %> <%= text_field 'transaction_detail[]', 'unit_price', :class => 'unitPrice' %> <%= text_field 'transaction_detail[]', 'unit_conversion_rate', :class => 'unitConvRate' %>
<% end %>

This generates the following repeated html block:

Account 1
<input class="qty" id="transaction_detail_quantity"

name=“transaction_detail[quantity]” size=“30” type=“text” />

<input class="qty" id="transaction_detail_quantity"

name=“transaction_detail[quantity]” size=“30” type=“text” />

I guess this is how it should be, but when I submit I only get the
values
back for the first record. I know I am missing something very basic, can
another set eyes help me?

TIA,
Harish

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs