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
This commit is contained in:
Emi Matchu 2015-04-07 23:13:22 -05:00
parent 0e6f823154
commit 9ca68b02b2

View file

@ -171,7 +171,7 @@ class Item
end end
}, },
:pet_type => lambda { |keyword| :pet_type => lambda { |keyword|
name1, name2 = keyword.split('-') name1, dash, name2 = keyword.rpartition('-')
[[name1, name2], [name2, name1]].each do |species_name, color_name| [[name1, name2], [name2, name1]].each do |species_name, color_name|
species = Species.find_by_name(species_name) species = Species.find_by_name(species_name)
next if species.nil? next if species.nil?