Arbitrary sized collections

Peter T. Brown
Fri, 28 Oct 2005 21:34:46 -0000

I have a list of URL''s I need to associate with a single Account
instance.
In my form, the number of URL''s passed in is between 1 and 10. I do not
see
how to handle this common situation...

Having constructed the Feed model objects that hold the URL and are
associated with the Account model I''ve tried:

         <% for @feed in @feeds %>
            <%= text_field ''feed[]'',
''url'' %>
         <% end %>

However this simply causes params(:feed) to equal the last item in the
list... Since each of these Feed objects is constructed new, none of them
have id''s. I''ve tried associated an incrementing index doing
something like:
<%= text_field "feed[#{i}]", ''url'' %> but I
get the error: "`@feed[0]'' is
not allowed as an instance variable name"


What should I do?

Thank You