Remove some unused PetType scopes

I looked at this and was like. "ok literally what is
`nonstandard_colors` trying to do"

reading it again now, I'm realizing the idea is that it probably runs
two queries: one to get nonstandard colors, then depends on
ActiveRecord to implicitly convert the relation to an array and then to
IDs for the second query? Instead of doing a join??

Idk, it's unused, so trash it!
This commit is contained in:
Emi Matchu 2024-02-16 23:32:22 -08:00
parent 15a905b0dd
commit 6515e525fb

View file

@ -16,12 +16,6 @@ class PetType < ApplicationRecord
attr_writer :origin_pet
BasicHashes = YAML::load_file(Rails.root.join('config', 'basic_type_hashes.yml'))
# Returns all pet types of a single standard color. The caller shouldn't care
# which, though, in this implemention, it's always Blue. Don't depend on that.
scope :single_standard_color, -> { where(:color_id => Color.basic.first) }
scope :nonstandard_colors, -> { where(:color_id => Color.nonstandard) }
scope :matching_name, ->(color_name, species_name) {
color = Color.find_by_name!(color_name)