On Sun, Apr 5, 2009 at 4:27 PM, Josh <joshbwh...@gmail.com> wrote:
>
> Nice work on the accepts nested attributes for, I've been waiting for
> this for a while and haven't had the time to write it.
>
> I am curious to know about the feature for deleting attributes. For a
> lot of reasons, I prefer to just not send back the items I want
> deleted. Do you think it would make sense to add an attribute called
> something like deletes_when_not_present that would essentially update
> or create the nested objects, and then deletes any that are present
> still in the database that weren't in the hash? Here is the basic of
> the workaround I'm using...
>
> old_ids = parent.get_children_ids
> parent.update(params[:parent])
> old_ids.each do |oid|
>  oid.member? parent.children_ids || Parent.destroy(oid)
> end
>
> Is there a reason it was skipped?

Eloy would know for sure, but I believe it was left out because of the
risk in accidentally deleting objects just because you disabled a form
element, or was paginating in a form, or something similar.

-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to