object_attorney 2.10.5 → 2.10.6
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 +8 -8
- data/lib/object_attorney/helpers.rb +4 -0
- data/lib/object_attorney/nested_objects.rb +1 -1
- data/lib/object_attorney/orm_handlers/smooth_operator.rb +1 -1
- data/lib/object_attorney/record.rb +2 -8
- data/lib/object_attorney/validations.rb +1 -1
- data/lib/object_attorney/version.rb +1 -1
- data/not_used/nested_uniqueness_validator.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NGI5YjAyYzdlODkyZWZhMjNlNGJjNzljNDI3YmRkYmY0NzRiMjFmMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDc0OTc4MGQ0ZDY4NWNhYTQyYTUyMDYxZTg3NWQ4NzQzM2NhYmI3Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTBkNmRhNjBkM2RkMTBiMWY3ZjYzZTVkMjc5Yjg4OWE5ZWYxZjhkY2ExZDE5
|
10
|
+
NjEwMmQzZWUyMDg1ZWI4YWJiZDQzNTFkNjU3Zjc4Y2UzZDViZjcwZTI0OWYx
|
11
|
+
NzY3ZWJkODFmZmRkYzgxNzJiZjU3MjU2NjNhZTc2Y2U1ZTA5NWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTNlMzMwNmQyOTIwZTNhZjJkMDZlMjAxOTQzYjEzYWVmMzIxOTU0MDlhZjdh
|
14
|
+
ZjQ1MGM0OTAwOGI3Y2JmNTFhNTlhNDA0MDc1OTg0YzQ3NzBhN2Q4Y2UwMTE1
|
15
|
+
ODRkMWNjMmFhYmNhYTkxZGVkMjE5ZDkwOTM4ZDViOWNkMTk4MDE=
|
@@ -84,7 +84,7 @@ module ObjectAttorney
|
|
84
84
|
private #################### PRIVATE METHODS DOWN BELOW ######################
|
85
85
|
|
86
86
|
def populate_foreign_key(origin, destination, reflection, macro)
|
87
|
-
return nil if represented_object.blank? ||
|
87
|
+
return nil if represented_object.blank? || Helpers.marked_for_destruction?(destination) || reflection.macro != macro
|
88
88
|
|
89
89
|
reflection.set_relational_keys(origin, destination)
|
90
90
|
end
|
@@ -28,7 +28,7 @@ module ObjectAttorney
|
|
28
28
|
if object == self || object == represented_object
|
29
29
|
represented_object.present? ? represented_object.send(save_method, options).ok? : true
|
30
30
|
else
|
31
|
-
save_method = :destroy if
|
31
|
+
save_method = :destroy if Helpers.marked_for_destruction?(object)
|
32
32
|
object.send(save_method, options).ok?
|
33
33
|
end
|
34
34
|
end
|
@@ -39,7 +39,7 @@ module ObjectAttorney
|
|
39
39
|
if object == self
|
40
40
|
represented_object.present? ? represented_object.send(save_method) : true
|
41
41
|
else
|
42
|
-
save_method = :destroy if
|
42
|
+
save_method = :destroy if Helpers.marked_for_destruction?(object)
|
43
43
|
object.send(save_method)
|
44
44
|
end
|
45
45
|
end
|
@@ -54,7 +54,7 @@ module ObjectAttorney
|
|
54
54
|
|
55
55
|
def populate_nested_imposed_errors
|
56
56
|
nested_objects.each do |reflection, nested_object|
|
57
|
-
next if
|
57
|
+
next if Helpers.marked_for_destruction?(nested_object)
|
58
58
|
|
59
59
|
nested_object.populate_imposed_errors
|
60
60
|
|
@@ -112,12 +112,6 @@ module ObjectAttorney
|
|
112
112
|
|
113
113
|
end
|
114
114
|
|
115
|
-
private #################### PRIVATE METHODS DOWN BELOW ######################
|
116
|
-
|
117
|
-
def check_if_marked_for_destruction?(object)
|
118
|
-
object.respond_to?(:marked_for_destruction?) ? object.marked_for_destruction? : false
|
119
|
-
end
|
120
|
-
|
121
115
|
end
|
122
116
|
|
123
117
|
end
|
@@ -7,7 +7,7 @@ module ActiveModel
|
|
7
7
|
uniq_value, existing_objects, first_element = options[:uniq_value], [], nil
|
8
8
|
|
9
9
|
record.send(attr_name).each do |object|
|
10
|
-
next if
|
10
|
+
next if Helpers.marked_for_destruction?(object)
|
11
11
|
|
12
12
|
first_element = object if first_element.nil?
|
13
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: object_attorney
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.10.
|
4
|
+
version: 2.10.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- João Gonçalves
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|