unaccents Debate.search terms and tests that
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user