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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd804bf6ae5a1bcfde3be60f0e914f4b94c312f9
4
- data.tar.gz: 0f98cd365ce16955256f2ef48d055ead7aa10a28
3
+ metadata.gz: 024757bccb9e16a295f97082cee1b318f7e567a4
4
+ data.tar.gz: 732cfe210693a46bbaac34614a0a2cf061c89622
5
5
  SHA512:
6
- metadata.gz: 3cf3a83d844e1085f05a9e89e60ac6280267d3f4ef2a90819ffd0e1526bbd653fc60f880bd2d10b85cbe2ae234a64c3d5967f96cef4660812febf0f6443c0925
7
- data.tar.gz: 632db998d7a93faf6f1d3d23d513d5230b5eb5a1505c41fb3394ae5ae6a6d08d30216beca8af701782002b30c50994df5a3cb1ebe26e6b3f482b3d92e987a8ed
6
+ metadata.gz: 69aeb76fc29426b17f34399694b0f76ca743b3ac45698d8afadb7185f0bb7b24dc0ed5a1561259bdde16550f4ba5059f72b4146c05d2244b9ced5a6bb3e71ae7
7
+ data.tar.gz: 958707a43e6d436054e2152410efd7bdeda97220eee29acc11ffa49b22591b759973fdedb2cf6bb70aa81acafb6cc975ba2394ca8b862c7b6f3edb3909735da8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.6
1
+ 1.1.7
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "algoliasearch-rails"
8
- s.version = "1.1.6"
8
+ s.version = "1.1.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Algolia"]
@@ -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 || !self.class.must_reindex?(self)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia