README.md in dependent-auto-rails-0.1.7 vs README.md in dependent-auto-rails-0.1.8

- old
+ new

@@ -1,12 +1,15 @@ +[![Version](https://img.shields.io/gem/v/dependent-auto-rails)][badges:0-gem] +[![Build](https://img.shields.io/github/actions/workflow/status/joshuay03/dependent-auto-rails/.github/workflows/main.yml?branch=main)][badges:1-workflow] + # dependent-auto-rails -This gem provides a new `dependent` option for ActiveRecord associations, `:auto`. Using this option will automatically select between `:destroy` and `:delete` / `:delete_all` during runtime based on whether or not the associated model has any destroy callbacks defined. This is useful since `dependent: :destroy` always initialises the associated records in order to execute their destroy callbacks regardless of whether or not there are any defined. This can be expensive if there are many records to destroy. +This gem provides a new `dependent` option for ActiveRecord associations, `:auto`. Using this option will automatically select between `:destroy` and `:delete` / `:delete_all` during runtime based on whether or not the associated model has any destroy callbacks defined. This is useful since `dependent: :destroy` always initialises the associated records in order to execute their destroy callbacks regardless of whether or not there are any defined, but is often the go-to option since it is the safest. This can be expensive if there are many records to destroy. It is also useful since a model's associations are rarely updated, but it's business logic can change frequently. This means that if destroy callbacks are added or removed on the associated model, the `dependent` option on the parent model's association may need to be updated to reflect this. Using `dependent: :auto` will automatically select the appropriate `dependent` option based on the current state of the model. -**NOTE**: The `:auto` option **ONLY** decides between `:destroy` and `:delete` / `:delete_all`. It does not support any other `dependent` options such as: +**NOTE**: The `:auto` option **ONLY** decides between `:destroy` and `:delete` / `:delete_all`. It does not support any other `dependent` option, such as: - `:nullify` - `:destroy_async` - `:restrict_with_error` - `:restrict_with_exception` @@ -55,5 +58,8 @@ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Dependent::Auto::Rails project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/dependent-auto-rails/blob/main/CODE_OF_CONDUCT.md). + +[badges:0-gem]: https://rubygems.org/gems/dependent-auto-rails +[badges:1-workflow]: https://github.com/joshuay03/dependent-auto-rails/blob/main/.github/workflows/main.yml