Commit 5569ac606b62ef2158f41f8d9f1c4dbfb272a7e5
1 parent
460f3891
Exists in
master
and in
2 other branches
Fixed index name for inherited models - fixes #1548
Showing
4 changed files
with
8 additions
and
5 deletions
Show diff stats
CHANGELOG.md
lib/searchkick/model.rb
... | ... | @@ -88,9 +88,9 @@ module Searchkick |
88 | 88 | if options[:index_name] |
89 | 89 | options[:index_name] |
90 | 90 | elsif options[:index_prefix].respond_to?(:call) |
91 | - -> { [options[:index_prefix].call, model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") } | |
91 | + -> { [options[:index_prefix].call, searchkick_klass.model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") } | |
92 | 92 | else |
93 | - [options.key?(:index_prefix) ? options[:index_prefix] : Searchkick.index_prefix, model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") | |
93 | + [options.key?(:index_prefix) ? options[:index_prefix] : Searchkick.index_prefix, searchkick_klass.model_name.plural, Searchkick.env, Searchkick.index_suffix].compact.join("_") | |
94 | 94 | end |
95 | 95 | end |
96 | 96 | end | ... | ... |
test/inheritance_test.rb
... | ... | @@ -13,7 +13,7 @@ class InheritanceTest < Minitest::Test |
13 | 13 | end |
14 | 14 | |
15 | 15 | def test_child_index_name |
16 | - assert_equal "animals-#{Date.today.year}#{ENV["TEST_ENV_NUMBER"]}", Dog.searchkick_index.name | |
16 | + assert_equal "animals_test#{ENV["TEST_ENV_NUMBER"]}", Dog.searchkick_index.name | |
17 | 17 | end |
18 | 18 | |
19 | 19 | def test_child_search | ... | ... |
test/models/animal.rb