algoliasearch-rails 1.11.3 → 1.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/README.md +44 -1
- data/VERSION +1 -1
- data/algoliasearch-rails.gemspec +2 -2
- data/lib/algoliasearch-rails.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32b3cc39ddb51e1ed05f6d42b0884ec31e45035b
|
4
|
+
data.tar.gz: d805300078c543d140d4ceaa9f88bd0159b7bf32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7a62a8f7c79036c0a51ed2bb2416262331abac6245496bb6b7585c849be486976e10a8e69a80c23ddbeaa9481031cf56111b59d43fac4c06046ef023084e2b0
|
7
|
+
data.tar.gz: 6703e4e84e65b8400476a0326a53df42d2744f811f495b9a49d01c81c2f54a78d263c74d3d7868ae56a6307dc85c809652c1d78c29ca52e4dc797fc3cd8d6592
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -221,10 +221,35 @@ class Contact < ActiveRecord::Base
|
|
221
221
|
attribute :full_name do
|
222
222
|
"#{first_name} #{last_name}"
|
223
223
|
end
|
224
|
+
add_attribute :full_name2
|
225
|
+
end
|
226
|
+
|
227
|
+
def full_name2
|
228
|
+
"#{first_name} #{last_name}"
|
229
|
+
end
|
230
|
+
end
|
231
|
+
```
|
232
|
+
|
233
|
+
***Notes:*** As soon as you use such code to define extra attributes, the gem is not anymore able to detect if the attribute has changed (the code uses Rails's `#{attribute}_changed?` method to detect that). As a consequence, your record will be pushed to the API even if its attributes didn't change. You can work-around this behavior creating a `_changed?` method:
|
234
|
+
|
235
|
+
```ruby
|
236
|
+
class Contact < ActiveRecord::Base
|
237
|
+
include AlgoliaSearch
|
238
|
+
|
239
|
+
algoliasearch do
|
240
|
+
attribute :email
|
241
|
+
attribute :full_name do
|
242
|
+
"#{first_name} #{last_name}"
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
def full_name_changed?
|
247
|
+
first_name_changed? || last_name_changed?
|
224
248
|
end
|
225
249
|
end
|
226
250
|
```
|
227
251
|
|
252
|
+
|
228
253
|
#### Custom ```objectID```
|
229
254
|
|
230
255
|
By default, the `objectID` is based on your record's `id`. You can change this behavior specifying the `:id` option (be sure to use a uniq field).
|
@@ -259,7 +284,25 @@ class Post < ActiveRecord::Base
|
|
259
284
|
end
|
260
285
|
```
|
261
286
|
|
262
|
-
**Notes:** As soon as you use those constraints, ```deleteObjects``` calls will be performed in order to keep the index synced with the DB (The state-less gem doesn't know if the object don't match your constraints anymore or never matched, so we force DELETE operations
|
287
|
+
**Notes:** As soon as you use those constraints, ```addObjects``` and ```deleteObjects``` calls will be performed in order to keep the index synced with the DB (The state-less gem doesn't know if the object don't match your constraints anymore or never matched, so we force ADD/DELETE operations to be sent). You can work-around this behavior creating a `_changed?` method:
|
288
|
+
|
289
|
+
```ruby
|
290
|
+
class Contact < ActiveRecord::Base
|
291
|
+
include AlgoliaSearch
|
292
|
+
|
293
|
+
algoliasearch if: :published do
|
294
|
+
end
|
295
|
+
|
296
|
+
def published
|
297
|
+
# true or false
|
298
|
+
end
|
299
|
+
|
300
|
+
def published_changed?
|
301
|
+
# return true only if you know that the 'published' state changed
|
302
|
+
end
|
303
|
+
end
|
304
|
+
```
|
305
|
+
|
263
306
|
|
264
307
|
You can index a subset of your records using either:
|
265
308
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.11.
|
1
|
+
1.11.4
|
data/algoliasearch-rails.gemspec
CHANGED
@@ -6,11 +6,11 @@
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "algoliasearch-rails"
|
9
|
-
s.version = "1.11.
|
9
|
+
s.version = "1.11.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Algolia"]
|
13
|
-
s.date = "2014-
|
13
|
+
s.date = "2014-10-05"
|
14
14
|
s.description = "AlgoliaSearch integration to your favorite ORM"
|
15
15
|
s.email = "contact@algolia.com"
|
16
16
|
s.extra_rdoc_files = [
|
data/lib/algoliasearch-rails.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|