From 9ca68b02b20ddf0403927c10c70b58e0700cb22e Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 7 Apr 2015 23:13:22 -0500 Subject: [PATCH] parse "fits:8-bit-chomby" as "fits 8-bit chomby" rather than "fits 8 bit" The "fits:8-bit-chomby" search filter was being read as color=8, species=bit. Now, we split from the right-hand side of the filter instead. Still a problem for anyone who explicitly types the Spanish/Portuguese ordering of "fits:chomby-8-bits", but I'm okay with this cheap fix, since I bet literally nobody has done that in the past month, if ever :P --- app/models/item/search/query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/item/search/query.rb b/app/models/item/search/query.rb index 099d416c..e35aec9b 100644 --- a/app/models/item/search/query.rb +++ b/app/models/item/search/query.rb @@ -171,7 +171,7 @@ class Item end }, :pet_type => lambda { |keyword| - name1, name2 = keyword.split('-') + name1, dash, name2 = keyword.rpartition('-') [[name1, name2], [name2, name1]].each do |species_name, color_name| species = Species.find_by_name(species_name) next if species.nil?