algoliasearch-rails 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/algoliasearch-rails.gemspec +1 -1
- data/lib/algoliasearch-rails.rb +10 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 024757bccb9e16a295f97082cee1b318f7e567a4
|
4
|
+
data.tar.gz: 732cfe210693a46bbaac34614a0a2cf061c89622
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69aeb76fc29426b17f34399694b0f76ca743b3ac45698d8afadb7185f0bb7b24dc0ed5a1561259bdde16550f4ba5059f72b4146c05d2244b9ced5a6bb3e71ae7
|
7
|
+
data.tar.gz: 958707a43e6d436054e2152410efd7bdeda97220eee29acc11ffa49b22591b759973fdedb2cf6bb70aa81acafb6cc975ba2394ca8b862c7b6f3edb3909735da8
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.7
|
data/algoliasearch-rails.gemspec
CHANGED
data/lib/algoliasearch-rails.rb
CHANGED
@@ -92,6 +92,7 @@ module AlgoliaSearch
|
|
92
92
|
end
|
93
93
|
unless options[:auto_index] == false
|
94
94
|
before_save :mark_for_auto_indexing if respond_to?(:before_save)
|
95
|
+
after_validation :mark_must_reindex if respond_to?(:after_validation)
|
95
96
|
after_save :perform_index_tasks if respond_to?(:after_save)
|
96
97
|
end
|
97
98
|
unless options[:auto_remove] == false
|
@@ -155,9 +156,9 @@ module AlgoliaSearch
|
|
155
156
|
return true if object.id_changed?
|
156
157
|
attributes(object).each do |k, v|
|
157
158
|
changed_method = "#{k}_changed?"
|
158
|
-
return true if respond_to?(changed_method) && send(changed_method)
|
159
|
+
return true if object.respond_to?(changed_method) && object.send(changed_method)
|
159
160
|
end
|
160
|
-
return false
|
161
|
+
return false
|
161
162
|
end
|
162
163
|
|
163
164
|
private
|
@@ -193,11 +194,17 @@ module AlgoliaSearch
|
|
193
194
|
@auto_indexing = true
|
194
195
|
end
|
195
196
|
|
197
|
+
def mark_must_reindex
|
198
|
+
@must_reindex = self.class.must_reindex?(self)
|
199
|
+
true
|
200
|
+
end
|
201
|
+
|
196
202
|
def perform_index_tasks
|
197
|
-
return if !@auto_indexing ||
|
203
|
+
return if !@auto_indexing || @must_reindex == false
|
198
204
|
index!
|
199
205
|
remove_instance_variable(:@auto_indexing) if instance_variable_defined?(:@auto_indexing)
|
200
206
|
remove_instance_variable(:@synchronous) if instance_variable_defined?(:@synchronous)
|
207
|
+
remove_instance_variable(:@must_reindex) if instance_variable_defined?(:@must_reindex)
|
201
208
|
end
|
202
209
|
end
|
203
210
|
end
|