From 6515e525fb97725c41db9b98fae728d264215b0e Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Fri, 16 Feb 2024 23:32:22 -0800 Subject: [PATCH] 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! --- app/models/pet_type.rb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/models/pet_type.rb b/app/models/pet_type.rb index 1d503c3f..a10dc3e7 100644 --- a/app/models/pet_type.rb +++ b/app/models/pet_type.rb @@ -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)