From: Kirk Haines Date: 2005-07-17T09:05:01+09:00 Subject: Re: Can Rails deal with related attributes in forms? On Saturday 16 July 2005 5:00 pm, Michael Schuerig wrote: > Yes, that's entirely possible. > > http://wiki.rubyonrails.com/rails/show/HowToEditObjectArraysUsingForms > > That still looks more complicated than it should, IMHO, but I think for > the time being there's no easier solution. Interesting little article. For comparison, here's the equivalent in my current IOWA version, with assumption that the list of items comes from somewhere useful, such as a database query, and is just passed to the List component when the list is called: Views: List.html -----

Item#list

@item.name

Edit ----- Edit.html -----

Edit itemlist

)


List ----- Controllers: List.iwa ----- class List < Iowa::Component attr_accessor :item, :items def goto_edit edit_page = page_named('Edit') edit_page.items = @items yield edit_page end end ----- Edit.iwa ----- class Edit < Iowa::Component attr_accessor :item. :items def go_back yield prev_page end def save_items # This really isn't needed unless something special needs to be done; the # changes automatically get saved. end end Note that this example above doesn't sound like it quite does what the OP was asking for, which is to have a master record with it's fields, and each of the associated records with their fields, all displayed in one big form for editing. Using my CRUDForm component to do that, the view would end up being something like this: -----

Edit itemlist


List ----- And the controller something like so: ----- import 'CRUDForm' class Edit < Iowa::Component attr_accessor :item def go_back yield prev_page end end ----- I'm sure one can do something similarly simple to use with Rails and Nitro, as well. Kirk Haines