diff --git a/app/models/debate.rb b/app/models/debate.rb index 0347f0edd..968431324 100644 --- a/app/models/debate.rb +++ b/app/models/debate.rb @@ -138,7 +138,7 @@ class Debate < ActiveRecord::Base end def self.search(terms) - terms.present? ? where("title ILIKE ? OR description ILIKE ?", "%#{terms}%", "%#{terms}%") : none + terms.present? ? where("unaccent(title) ILIKE unaccent(?) OR unaccent(description) ILIKE unaccent(?)", "%#{terms}%", "%#{terms}%") : none end def conflictive? diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index edb5c2725..bcddab7a4 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -439,10 +439,10 @@ feature 'Debates' do debate1 = create(:debate, title: "Show me what you got") debate2 = create(:debate, title: "Get Schwifty") debate3 = create(:debate) - debate4 = create(:debate, description: "Schwifty in here") + debate4 = create(:debate, description: "Schwíftÿ in here") visit debates_path - fill_in "search", with: "Schwifty" + fill_in "search", with: "Schwìfty" click_button "Search" within("#debates") do