Skip to content

Commit

Permalink
Merge pull request #51 from sascha-karnatz/use-stripped_body-for-rich…
Browse files Browse the repository at this point in the history
…text-ingredient

Use stripped_body field for Richtext ingredient
  • Loading branch information
tvdeyen authored Oct 8, 2024
2 parents b68faf7 + 05df9cf commit fccf6d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/extensions/alchemy/pg_search/ingredient_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ def searchable?
# add the PgSearch model to all ingredients
Alchemy::Ingredient.prepend(Alchemy::PgSearch::IngredientExtension)

# only enable the search for Text, Richtext, and Picture
# add custom content fields for Richtext, and Picture
Alchemy::Ingredients::Picture.multisearchable(Alchemy::PgSearch::IngredientExtension.multisearch_config.merge({against: [:caption]}))
Alchemy::Ingredients::Richtext.multisearchable(Alchemy::PgSearch::IngredientExtension.multisearch_config.merge({against: [:stripped_body]}))
2 changes: 1 addition & 1 deletion spec/models/ingredient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
end

describe Alchemy::Ingredients::Richtext do
let(:ingredient) { create(:alchemy_ingredient_richtext, value: content, element: element) }
let(:ingredient) { create(:alchemy_ingredient_richtext, value: "<b>foo</b> bar", element: element) }

it_behaves_like "it is searchable"
it_behaves_like "it is in search index"
Expand Down

0 comments on commit fccf6d5

Please sign in to comment.