On Mar 16, 12:32 pm, tilt <[email protected]> wrote:
> I'd like to add and remove the owned objects dynamically using AJAX
> requests, but using f.fields_for :object do |object_form| doen't let
> me load new objects into the form - or at least I don't fully
> understand how that should work.
>
> Should I use fileds_for :object, iterator do |object_form instead?
> Does anyone know a simple example for this kind of usage on the web?

I'm not sure exactly which bit you are stuck at but any modifications
to the object association should be represented by fields_for. As one
way you can get a new object template is to simply build a blank one
on the collection, e.g:
@parent = Parent.find(..)
@parent.assoc_objects.build
form_for @parent... do |f|
  f.fields_for :assoc_objects do..
     # Will have 'empty' here

Hope that helps.

Andrew


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to