New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci skip] Clarify deletion strategies for collection proxies #17179

Merged
merged 1 commit into from Oct 5, 2014

Conversation

Projects
None yet
2 participants
@eileencodes
Copy link
Member

eileencodes commented Oct 4, 2014

For detailed testing of behavior see:
https://gist.github.com/eileencodes/5b0a2fe011dcff6203fe

This shows destroy_all always instantiates records and fires callbacks according to the :destroy strategy. It never uses nullify or delete_all strategies.

delete_all's behavior varies greatly based on hm vs hm:t and deletion strategy. See test gist for clarification.

The documentation was mostly correct except for a delete_all with a :destroy dependency actually follows the :delete_all strategy not the :destroy strategy. This was changed in this PR #10604

[ci skip] Clarify deletion strategies for collection proxies
For detailed testing of behavior see:
https://gist.github.com/eileencodes/5b0a2fe011dcff6203fe

This shows destroy_all always destroys records and fires callbacks.
It will never use nullify or delete_all

delete_all's behavior varies greatly based on `hm` vs `hm:t` and deletion
strategy.

@eileencodes eileencodes force-pushed the eileencodes:clarify-delete-strategies-on-collection-proxy branch to 02d3a25 Oct 4, 2014

@zzak

This comment has been minimized.

Copy link
Member

zzak commented Oct 5, 2014

@eileencodes Excellent detective work! :shipit:

zzak added a commit that referenced this pull request Oct 5, 2014

Merge pull request #17179 from eileencodes/clarify-delete-strategies-…
…on-collection-proxy

[ci skip] Clarify deletion strategies for collection proxies

@zzak zzak merged commit b5a8fd7 into rails:master Oct 5, 2014

@eileencodes eileencodes deleted the eileencodes:clarify-delete-strategies-on-collection-proxy branch Mar 6, 2015

repinel added a commit to repinel/rails that referenced this pull request Jun 3, 2015

[ci skip] fix the `collection.clear` guide
Improve the guide about `has_many` `collection.clear` to indicate
the behavior for each dependent strategy according to
`collection.delete_all`.

Based on rails#17179, I changed the `collection.delete` docs to also
clarify the default strategy for each `hm` and `hm:t` associations.

Fixes rails#20170.

repinel added a commit to repinel/rails that referenced this pull request Jun 3, 2015

[ci skip] fix the `collection.clear` guide
Improve the guide about `has_many` `collection.clear` to indicate
the behavior for each dependent strategy according to
`collection.delete_all`.

Based on rails#17179, I changed the `collection.delete` docs to also
clarify the default strategy for each `hm` and `hm:t` associations.

Fixes rails#20170.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment