Hi Josh and Ara,
I'm gonna respond inline to all thoughts/questions:
Josh,
Rails already have keywords for that: :nullify in associations
means :unlink.
So why do not do like this:
accepts_nested_attributes_for :something, :when_missing => :nullify
Those values could
be: :nullify, :destroy, :destroy_all, :delete, :delete_all.
Which are all the options supported by :dependent in associations.
I agree that if we are gonna add any of these types of linking/unlinking methods they should reflect those that AR already supports. I myself made the mistake of using _delete instead of _destroy, which is what actually happens, so that would have to be fixed as well then. Sorry 
On any update attributes method we don't destroy attributes that
aren't present,
But when an attribute is present we don't combine the old and new
attribute
I am not certain about has_one, but I think for sure we treat it like
a real attribute, so a blank nested attribute should mean unlink, if
not destroy it... (or an option for such!)
In a has many a nested attribute isn't an attribute at all, its a
foriegn key reference to another table. So, maybe instead of making a
total destruction patch, at least have the feature
have a accepts_nested_attributes_for something :unlink_not_present =>
true
This will at least remove the reference to the id in a join table.
Maybe, maybe not?
You should already be able to at least replace a single associated with a new one by not sending the :id in the attributes.
But I'd love to see improvements in this area which cover collection associations as well and in a way which makes it as transparent as possible, so for instance re-using the keywords from the AR API as suggested by José.
first off, nested attributes are wickedly cool, so thanks for that.
Glad you like it 
now re-using the view for all those actions makes this a bit more
complicated (but also nicer to the user), nevertheless three things
stood out as being *too* hard for most people of even modest skill:
1) building up the right ids and names - the patch i sent it to name
them in a POLS fashion, which you reviewed, fixes this completely
although the names/ids are still verbose there's no way around it
2) the whole blank association thing isn't quite obvious. i have
":reject_if => {|h| h.values.all?{|v| v.blank?}}" of course, but this
pattern of hanging blank objects off the parent in the right places in
actions (such as when an error occurs on a post and you need the error
page to have the blank objects you just rejected as they were all
blank) could use some thought.
By “the whole blank association thing” are you referring to instantiating new records before building a form with empty entries so the user can create new ones? If so, that seems imo to something you already have in your new/edit action flow so it shouldn't be a too big hurt, but does allow the developer as much flexibility as possible.
However, there is in fact a patch which could make this a great deal easier by Mike Breen, please verify and/or respond to the ticket if this idea would fit your (anyone's) applications: #2365 add :new_if_blank option to fields_for for nested associations - Ruby on Rails - rails
I'm not sure if you were suggesting some default option which does: ":reject_if => {|h| h.values.all?{|v| v.blank?}}"? If so, trying to abstract this from the developer went wrong quite fast, because the hash might in fact not be empty at all for various reasons while from the developers pov it was considered "blank". This can happen because you use the checkfields helper which always add a value, or have another blank nested attributes hash inside the "blank" hash, etc. Trying to come up with a way to deal with those issues would require complicated code and was at least at that time a reason for me to leave it as non ambiguous as possible, which was letting the developer handle it exactly as she wanted.
3) finally, as josh mentions. deleting is a bitch, esp if you are
intermixing valid updates with some deletes. maybe i missed an easier
way but the simplest paradigm would seem to be 'copy and element rails
made and munge the fuck out of it until it makes a valid deletion hash
when unpacked into params'
I don't quite follow. Correct me if I misunderstood;
If you have a form which contains fields for an existing record, then deleting it means setting its :id attribute to a truthy value, that seems fairly easy to me.
so, on 3 i am *sort* of with josh. my 2cts, however, is that doing
automatic object deletion is a *huge* deal that could make some users
really *mad* if done right for all the reasons you mention. because
of that i think and new AR method is the ticket: what josh and i
really want is a 'replace_attributes' method. that name is so
explicit, and has no un-intended side effects (like nuking stuff in
the middle of a paged post) that i think it would be the best way.
the impl is obvious, transaction{ nuke; update; } and i'd be happy to
build a patch, but would like some feedback on the idea.
Yes, we should _never_ turn on any automatic deletion/unlinking method by default. However, I don't think it's necessary to add an extra accessor, we simply need an implementation.
Let me put together what I have said throughout earlier similar discussions. I'm open to any of these sort of changes under the following circumstances:
* It should be an extraction, not a theoretical thing. Since I didn't need that at the time it was safer to leave this kind of behaviour out and see what others who do need it come up with. (Which could have been myself as well, but the situation hasn't occurred yet.)
* As transparent as possible, so the API should be familiar to developers using AR.
* It should be as naive and simple as possible, ie no magic, to not obstruct a developer in creating complex forms or abstract her too far away from the metal. Because these types of forms can become complicated in ways we can never imagine and we should not limit that possibility.
So seeing the two of you actually have applications that need to deal with these situations; Yes please, a patch would be great! What a long answer huh? 
Also see the following tickets which have been discussing this as well:
* #1892 nested attributes should not have meaningful hash keys - Ruby on Rails - rails (near the end)
* #2036 Linking and unlinking via accepts_nested_attributes_for - Ruby on Rails - rails
Cheers,
Eloy