mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-10-23 15:28:23 -04:00
make crop search case insensitive
This commit is contained in:
1 parent
8897e5149d
commit
77d2b0e950
2 files changed
+4
-1
No files matched your search
+1
-1
@@ -174,7 +174,7 @@ class Crop < ActiveRecord::Base
|
||||
# searches for crops whose names match the string given
|
||||
# just uses SQL LIKE for now, but can be made fancier later
|
||||
def self.search(query)
|
||||
where("name LIKE ?", "%#{query}%")
|
||||
where("name ILIKE ?", "%#{query}%")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -321,6 +321,9 @@ describe Crop do
|
||||
it "doesn't find non-matches" do
|
||||
Crop.search('mush').should_not include @crop
|
||||
end
|
||||
it "searches case insensitively" do
|
||||
Crop.search('mUsH').should include @mushroom
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user