When filtering to a specific pet type, redirect right to it!

That is, if you filter to "Candy Chia", we just redirect straight to
it, if it exists; rather than showing you a results page.
This commit is contained in:
Emi Matchu 2024-10-11 15:13:59 -07:00
parent 7c1b3ca447
commit bba863b94b

View file

@ -25,6 +25,10 @@ class PetTypesController < ApplicationController
if @selected_color if @selected_color
@pet_types = @pet_types.where(color_id: @selected_color) @pet_types = @pet_types.where(color_id: @selected_color)
end end
if @selected_species && @selected_color && @pet_types.size == 1
redirect_to @pet_types.first
end
} }
format.json { format.json {