Commit a040066c4b09eae52d1aaadcc2a46f85e2903c0a
1 parent
d7312a30
Exists in
master
and in
18 other branches
Added :inline as alias for true for callbacks and mode options - closes #1133
Showing
3 changed files
with
5 additions
and
4 deletions
Show diff stats
CHANGELOG.md
1 | ## 3.0.4 [unreleased] | 1 | ## 3.0.4 [unreleased] |
2 | 2 | ||
3 | +- Added `:inline` as alias for `true` for `callbacks` and `mode` options | ||
3 | - Friendlier error message for bad mapping with partial matches | 4 | - Friendlier error message for bad mapping with partial matches |
4 | - Warn when records in search index do not exist in database | 5 | - Warn when records in search index do not exist in database |
5 | 6 |
lib/searchkick/model.rb
@@ -16,8 +16,8 @@ module Searchkick | @@ -16,8 +16,8 @@ module Searchkick | ||
16 | 16 | ||
17 | options[:_type] ||= -> { searchkick_index.klass_document_type(self, true) } | 17 | options[:_type] ||= -> { searchkick_index.klass_document_type(self, true) } |
18 | 18 | ||
19 | - callbacks = options.key?(:callbacks) ? options[:callbacks] : true | ||
20 | - unless [true, false, :async, :queue].include?(callbacks) | 19 | + callbacks = options.key?(:callbacks) ? options[:callbacks] : :inline |
20 | + unless [:inline, true, false, :async, :queue].include?(callbacks) | ||
21 | raise ArgumentError, "Invalid value for callbacks" | 21 | raise ArgumentError, "Invalid value for callbacks" |
22 | end | 22 | end |
23 | 23 |
lib/searchkick/record_indexer.rb
@@ -8,7 +8,7 @@ module Searchkick | @@ -8,7 +8,7 @@ module Searchkick | ||
8 | end | 8 | end |
9 | 9 | ||
10 | def reindex(method_name = nil, refresh: false, mode: nil) | 10 | def reindex(method_name = nil, refresh: false, mode: nil) |
11 | - unless [true, nil, :async, :queue].include?(mode) | 11 | + unless [:inline, true, nil, :async, :queue].include?(mode) |
12 | raise ArgumentError, "Invalid value for mode" | 12 | raise ArgumentError, "Invalid value for mode" |
13 | end | 13 | end |
14 | 14 | ||
@@ -31,7 +31,7 @@ module Searchkick | @@ -31,7 +31,7 @@ module Searchkick | ||
31 | record.id.to_s, | 31 | record.id.to_s, |
32 | method_name ? method_name.to_s : nil | 32 | method_name ? method_name.to_s : nil |
33 | ) | 33 | ) |
34 | - else # bulk, true | 34 | + else # bulk, inline/true |
35 | reindex_record(method_name) | 35 | reindex_record(method_name) |
36 | 36 | ||
37 | index.refresh if refresh | 37 | index.refresh if refresh |