Commit a040066c4b09eae52d1aaadcc2a46f85e2903c0a

Authored by Andrew
1 parent d7312a30

Added :inline as alias for true for callbacks and mode options - closes #1133

CHANGELOG.md
1 1 ## 3.0.4 [unreleased]
2 2  
  3 +- Added `:inline` as alias for `true` for `callbacks` and `mode` options
3 4 - Friendlier error message for bad mapping with partial matches
4 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 16  
17 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 21 raise ArgumentError, "Invalid value for callbacks"
22 22 end
23 23  
... ...
lib/searchkick/record_indexer.rb
... ... @@ -8,7 +8,7 @@ module Searchkick
8 8 end
9 9  
10 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 12 raise ArgumentError, "Invalid value for mode"
13 13 end
14 14  
... ... @@ -31,7 +31,7 @@ module Searchkick
31 31 record.id.to_s,
32 32 method_name ? method_name.to_s : nil
33 33 )
34   - else # bulk, true
  34 + else # bulk, inline/true
35 35 reindex_record(method_name)
36 36  
37 37 index.refresh if refresh
... ...