Skip to content

Commit

Permalink
Bring models behavior inline with index_name - #1259
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed May 3, 2019
1 parent 689c28c commit 68632a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/searchkick/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def params
if options[:models]
@index_mapping = {}
Array(options[:models]).each do |model|
@index_mapping[model.searchkick_index.name] = model
@index_mapping[model.searchkick_index.name] = model.searchkick_klass
end
end

Expand Down
7 changes: 7 additions & 0 deletions test/inheritance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ def test_reindex
assert_equal 2, Animal.search("bear").size
end

def test_multiple_models
store_names ["Bear A"], Cat
store_names ["Bear B"], Dog
Animal.reindex
assert_equal 2, Searchkick.search("bear", models: [Cat, Dog]).size
end

# TODO move somewhere better

def test_multiple_indices
Expand Down

0 comments on commit 68632a7

Please sign in to comment.