Commit 5a6bcb7f7d422f653ad702bb66b3c2e84e3c4134
1 parent
0ef6c9b9
Exists in
master
and in
21 other branches
Better example for controlling which records are indexed - #735
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
README.md
... | ... | @@ -374,10 +374,12 @@ class Product < ActiveRecord::Base |
374 | 374 | end |
375 | 375 | ``` |
376 | 376 | |
377 | -By default, all records are indexed. To control which records are indexed, use the `should_index?` method. | |
377 | +By default, all records are indexed. To control which records are indexed, use the `should_index?` method together with the `search_import` scope. | |
378 | 378 | |
379 | 379 | ```ruby |
380 | 380 | class Product < ActiveRecord::Base |
381 | + scope :search_import, -> { where(active: true) } | |
382 | + | |
381 | 383 | def should_index? |
382 | 384 | active # only index active records |
383 | 385 | end | ... | ... |