George, I haven't looked too deeply at your situation, but if you're using merb, I have a feeling you may be running into a similar issue to one I had a while back. In my case my conclusion was that there were some limitations in merb's form helpers that prevented them from constructing the input arrays in the way I had expected based on my experience with Rails. However the actual parsing of the inputs in the merb request handler is fine. My work-around was to use the :name option in the field helpers to explicitly construct the inputs in the form I needed. This thread has a few details -
http://groups.google.com/group/merb/browse_thread/thread/d1a192fbe2919497/9b6aef5c470f0b2b?#9b6aef5c470f0b2b Mark. George wrote: > If a Client model has-n addresses, what's the best way to handle these > on a form? > > class Client > ... > has n, :client_addresses > has n, :addresses, :through => :client_addresses > ... > end > > In a Client edit form we have something like this: > <% client.addresses.each do |address| %> > <div> > <%= fields_for address do %> > <%= text_field :address1, :label=>"Number/name" %> > <%= text_field :address2, :label=>"Locality" %> > ...etc... > <% end =%> > </div> > <% end %> > > That renders each html address field with names like "address > [address1]" so I would expect the server side to receive those as > arrays of 0-or-more values. Looking at the output it seems that merb > only sees one value for each field. > Is this the right approach? How should we handle the submitted address > fields server side? > I suppose I could parse the params object manually but that is not > very reusable. > > Many thanks > George -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=.