has_reindexable_associations 0.1.2 → 0.1.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/README.md +31 -10
- data/has_reindexable_associations.gemspec +1 -1
- data/lib/has_reindexable_associations/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e26e78204a772eea93a7b6140aef4150d18b1a8
|
4
|
+
data.tar.gz: da0e8ebe166ca96350722d86b2070af2d01a369a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 742efd4d0391a0b86caaee268cc76bd1e757a21f660755a1949a662a3fc2954e18b4fdc23279f66bf256d8391f5cb9a501cd4c0eb5658055602a4c9e8e41ea06
|
7
|
+
data.tar.gz: dfcdb8b0e80cb8eda90a4b6b2db507b23112105f77f9bf5689656f8f01b0c11295cc869e5fa1e8d2549b3a9eebfc26b3a7704779cf5367cf7c8a4672882c742b
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# HasReindexableAssociations [](https://travis-ci.org/efigence/has_reindexable_associations)
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/has_reindexable_associations`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
2
|
+
Keep specified associations in sync with ease using async reindexing ([searchkick](https://github.com/ankane/searchkick) gem is required).
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
|
@@ -22,7 +19,35 @@ Or install it yourself as:
|
|
22
19
|
|
23
20
|
## Usage
|
24
21
|
|
25
|
-
|
22
|
+
```ruby
|
23
|
+
MyClass < ActiveRecord::Base
|
24
|
+
include HasReindexableAssociations
|
25
|
+
|
26
|
+
belongs_to :some_association
|
27
|
+
has_many :some_associations
|
28
|
+
|
29
|
+
has_reindexable_associations :some_association, :some_associations
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
### Handle imports
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# set `reindexable_associations_skip` class attribute to `true` before any seeds or imports to postpone the reindexing of associations
|
37
|
+
MyClass.reindexable_associations_skip = true
|
38
|
+
|
39
|
+
# import data
|
40
|
+
MyClass.import(...)
|
41
|
+
|
42
|
+
# reindex data
|
43
|
+
MyClass.reindex
|
44
|
+
|
45
|
+
# revert the configuration option
|
46
|
+
MyClass.reindexable_associations_skip = false
|
47
|
+
|
48
|
+
# reindex associations after import (repeat for each imported model, eg. MyClass, that has `has_reindexable_associations` configured)
|
49
|
+
MyClass.reindexable_associations.each { |association| MyClass.send(association).model.reindex }
|
50
|
+
```
|
26
51
|
|
27
52
|
## Development
|
28
53
|
|
@@ -32,11 +57,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
57
|
|
33
58
|
## Contributing
|
34
59
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
-
|
37
|
-
## TODO
|
38
|
-
|
39
|
-
write README.md
|
60
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/efigence/has_reindexable_associations. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
40
61
|
|
41
62
|
## License
|
42
63
|
|
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["mkalita@efigence.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Automatic Elasticsearch Reindexing of Active Record Associations}
|
13
|
-
spec.description = %q{Keep specified associations in sync with ease using async reindexing (searchkick gem).}
|
13
|
+
spec.description = %q{Keep specified associations in sync with ease using async reindexing (searchkick gem is required).}
|
14
14
|
spec.homepage = "https://github.com/efigence/has_reindexable_associations"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_reindexable_associations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcin Kalita
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '5.0'
|
97
97
|
description: Keep specified associations in sync with ease using async reindexing
|
98
|
-
(searchkick gem).
|
98
|
+
(searchkick gem is required).
|
99
99
|
email:
|
100
100
|
- mkalita@efigence.com
|
101
101
|
executables: []
|