> Oh yeah, I should add a refinement of "Approach 4":
>
> {
>   :tasks_params =>
>     {
>       '1' => { :id => '3', :name => 'Foo' },
>       '2' => { :id => '17', :_delete => '1', :name => 'Bob' },
>       '3' => { :name => 'Bar' },
>       '4' => { :name => 'Baz' }
>     }
> }
>
> The presence of a :_delete param is used to indicate that an old
> record should be deleted.  This can be done simply with a checkbox or
> a JavaScript control.  I think this works much better than trying to
> delete records that just happen to be missing from the hash, since
> that can get ugly if you are paginating a bunch of records or
> otherwise subsetting e the list.

I really can't think of a common use case for this scenario.
It seems to me that when you're paginating a form, or any other edge  
case,
you shouldn't rely on any naive solution, but rather solve it yourself  
in your controller/model.

This is why I personally feel that destroying a record should be off  
by default.

But for simple common use cases, where you might have removed
a child from the DOM, the naive/simple approach I took in my plugin is  
good enough IMO.

>> Using the presence of the :id attribute to distinguish old vs new
>> records seems ok, but it might get wonky for edge cases that use a
>> different primary key.  I think I do like that approach.  The thing
>> that is important that some of the gisted approaches miss is being
>> able to order new records in the form.  It can get seriously  
>> confusing
>> for users if data shifts around form one place to another if they
>> failed a validation and need to correct something.

This is a very valid point which I have fixed in:
http://github.com/alloy/complex-form-examples/commit/4c740d5d8f5f99c0bfa5c3f38162ef26329c7cf0
Thanks for bringing that up.

>> I'm not particularly attached to using two different faux accessors
>> for create vs update.  It's nice and clean, but really any way that
>> lets you tell create vs update is fine by me.

I'm sorry, but my English is not good enough to follow this bit.
Could you maybe explain it some more or in other words?

Eloy

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to