Here's a plugin extracted from one of our apps and then extended for Ryan Bates's complex-form-examples. We only needed it for has_many and has_one associations atm, so I haven't worked/tried it on others yet.
The plugin exists of 3 parts: - AutosaveAssociation, which as the name implies automatically saves associations, not only on create as is the default. - NestedParams, which is my take on this problem. It creates/updates/ destroys associations. This uses AutosaveAssociation. - NestedParamsFormBuilder, which is a subclass of FormBuilder that adds code to #fields_for for handling NestedParams enabled models. Obviously this is a wip, but it might be interesting for the discussion as well. http://github.com/alloy/complex-form-examples/tree/alloy-nested_params/vendor/plugins/has_autosave_and_nested_params Cheers, Eloy On 12 sep 2008, at 19:04, Josh Susser wrote: > > I like this feature too, but agree that it wasn't ready for prime time > yet. I just put up a patch for my own take on how to do this. It's > not the whole story, but I wanted to get it up there so we can talk > about it: > > http://rails.lighthouseapp.com/projects/8994/tickets/1031 > > -- > Josh Susser > http://blog.hasmanythrough.com > > On Sep 10, 1:23 pm, "Zack Chandler" <[EMAIL PROTECTED]> wrote: >> Pratik, >> >> Got it - I figured it was prep time for 2.2... I for one would like >> to see this reapplied and iterated on after 2.2 is tagged as it >> really >> helps out with multi-model forms. >> >> Best, >> Zack >> >> On Wed, Sep 10, 2008 at 12:50 PM, Pratik <[EMAIL PROTECTED]> >> wrote: >>> Hey Zach, >> >>> The :accessible change was not complete and still needs some more >>> work to be >>> usable. There was no conclusion about how we want updates to work - >>> http://groups.google.com/group/rubyonrails-core/browse_thread/thread/ >>> ... >> >>> As 2.2 is very close, I didn't want any half baked changes to be >>> in stable >>> release. But I'd be happy to apply the patch again, and work >>> incremently >>> after we have a 2.2 branch. >> >>> On Wed, Sep 10, 2008 at 8:36 PM, Zack Chandler >>> <[EMAIL PROTECTED]> >>> wrote: >> >>>> I noticed that Pratik just reverted the ":accessible option to >>>> allow >>>> for allowing mass assignments" with the following commit: >> >>>> http://github.com/rails/rails/commit/9994f0d90248db7d7eae36f0b597a15e >>>> ... >> >>>> What was the reason behind this reversion? >> >>>> I've been using the feature and it works great for my needs. >> >>>> Best, >> >>>> Zack Chandler >>>> http://depixelate.com >> >>> -- >>> Cheers! >>> - Pratik >>> http://m.onkey.org > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
