ar_sync 1.0.2 → 1.0.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ar_sync/class_methods.rb +19 -11
- data/lib/ar_sync/version.rb +1 -1
- data/package.json +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 949fc166a975785ab522fe3a2714bf334a56c1f2d4e32931aced7b3ee1de65ac
|
|
4
|
+
data.tar.gz: f9428cc4dbf7e2e7cea7c2f958198e628f7ad92241d71c351e8328b856a315de
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dff083ce7735e475c3104b7581da185e8bd872e76afd8addeecfd5ebc9d292cb299358edeb9d445c5aac268813d4bd358a886bd89dff761eab8dbbac2fa75593
|
|
7
|
+
data.tar.gz: 54ce2594a8749284200924456188fc7b7a3836f8719cbaea4b2626823e9bbe1879cc6a8d7dad327e82f83d7f48d488620eef18f94bda6297aecf1c87d3893b85
|
data/Gemfile.lock
CHANGED
|
@@ -110,20 +110,28 @@ module ArSync::ModelBase::ClassMethods
|
|
|
110
110
|
sync_parent collection, inverse_of: [self, name]
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
+
module WriteHook
|
|
114
|
+
def _initialize_sync_info_before_mutation
|
|
115
|
+
self.class.default_scoped.scoping do
|
|
116
|
+
@_sync_watch_values_before_mutation ||= _sync_current_watch_values
|
|
117
|
+
@_sync_parents_info_before_mutation ||= _sync_current_parents_info
|
|
118
|
+
@_sync_belongs_to_info_before_mutation ||= _sync_current_belongs_to_info
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
def _write_attribute(attr_name, value)
|
|
122
|
+
_initialize_sync_info_before_mutation
|
|
123
|
+
super attr_name, value
|
|
124
|
+
end
|
|
125
|
+
def write_attribute(attr_name, value)
|
|
126
|
+
_initialize_sync_info_before_mutation
|
|
127
|
+
super attr_name, value
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
113
131
|
def _initialize_sync_callbacks
|
|
114
132
|
return if instance_variable_defined? '@_sync_callbacks_initialized'
|
|
115
133
|
@_sync_callbacks_initialized = true
|
|
116
|
-
|
|
117
|
-
def _write_attribute(attr_name, value)
|
|
118
|
-
self.class.default_scoped.scoping do
|
|
119
|
-
@_sync_watch_values_before_mutation ||= _sync_current_watch_values
|
|
120
|
-
@_sync_parents_info_before_mutation ||= _sync_current_parents_info
|
|
121
|
-
@_sync_belongs_to_info_before_mutation ||= _sync_current_belongs_to_info
|
|
122
|
-
end
|
|
123
|
-
super attr_name, value
|
|
124
|
-
end
|
|
125
|
-
end
|
|
126
|
-
prepend mod
|
|
134
|
+
prepend WriteHook
|
|
127
135
|
attr_reader :_sync_parents_info_before_mutation, :_sync_belongs_to_info_before_mutation, :_sync_watch_values_before_mutation
|
|
128
136
|
|
|
129
137
|
_sync_define :id
|
data/lib/ar_sync/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ar_sync
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- tompng
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|