active_record-nested_attributes-destroy_if 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb8fdfa9077353df3588817a550c8d311b8b6827337f3e76b7dcaa7f6f2cd1d7
|
4
|
+
data.tar.gz: 25205f8a4dda44acb15092e26304c7b7394ce736468f1dcaa139d7e3f235c463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41c6e6afa3e0b47092c144207586bc3ed0e0b065237e79db3653907b9ff9ee4c93dd3f87287c8ed77f6bd5dd052cf9d16a41eec4d3d4f985cf7d4a8be7d69ef6
|
7
|
+
data.tar.gz: 5b5d1274cb6a4609a920877b65a8f801f690da96439712683ee935675c15c81bfdb357fbeb5a3c4f5ed8df5e3b621365b4de3042acad3bbc0d645092a0b9c3fc
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ActiveRecord::NestedAttributes::DestroyIf
|
2
2
|
|
3
|
-
[](https://github.com/botandrose/active_record-nested_attributes-destroy_if/actions?query=workflow%3ACI+branch%3Amaster)
|
4
4
|
|
5
5
|
Adds a `:destroy_if` option to `.accepts_nested_attributes_for`, which is basically a stronger version of `:reject_if` that also destroys existing records.
|
6
6
|
|
@@ -11,7 +11,7 @@ module ActiveRecord
|
|
11
11
|
options = { allow_destroy: false, update_only: false }
|
12
12
|
options.update(attr_names.extract_options!)
|
13
13
|
options.assert_valid_keys(:allow_destroy, :reject_if, :destroy_if, :limit, :update_only)
|
14
|
-
options[:reject_if] = REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank
|
14
|
+
options[:reject_if] = ActiveRecord::NestedAttributes::ClassMethods::REJECT_ALL_BLANK_PROC if options[:reject_if] == :all_blank
|
15
15
|
|
16
16
|
attr_names.each do |association_name|
|
17
17
|
if reflection = _reflect_on_association(association_name)
|
@@ -114,7 +114,7 @@ module ActiveRecord
|
|
114
114
|
if target_record
|
115
115
|
existing_record = target_record
|
116
116
|
else
|
117
|
-
association.add_to_target(existing_record, :
|
117
|
+
association.add_to_target(existing_record, skip_callbacks: true)
|
118
118
|
end
|
119
119
|
|
120
120
|
assign_to_or_mark_for_destruction(existing_record, attributes, options[:allow_destroy], options[:destroy_if])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record-nested_attributes-destroy_if
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|