From e8737a520ecd47776a98302b3991f98e427b8f23 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sat, 24 Feb 2024 15:19:28 -0800 Subject: [PATCH] Remove more unused SwfAsset scopes Wowzers, a lot of cruft in here! I hope I'm not deleting anything important, but I think my Ctrl-F audits are checking out? --- app/models/swf_asset.rb | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/app/models/swf_asset.rb b/app/models/swf_asset.rb index 56572864..38e62fad 100644 --- a/app/models/swf_asset.rb +++ b/app/models/swf_asset.rb @@ -16,8 +16,6 @@ class SwfAsset < ApplicationRecord belongs_to :zone has_many :parent_swf_asset_relationships - - scope :includes_depth, -> { includes(:zone) } before_validation :normalize_manifest_url, if: :manifest_url? @@ -51,28 +49,8 @@ class SwfAsset < ApplicationRecord delegate :depth, :to => :zone - scope :fitting_body_id, ->(body_id) { - where(arel_table[:body_id].in([body_id, 0])) - } - - scope :fitting_color, ->(color) { - body_ids = PetType.select(:body_id).where(:color_id => color.id).map(&:body_id) - body_ids << 0 - where(arel_table[:body_id].in(body_ids)) - } - scope :biology_assets, -> { where(:type => PetState::SwfAssetType) } scope :object_assets, -> { where(:type => Item::SwfAssetType) } - scope :for_item_ids, ->(item_ids) { - joins(:parent_swf_asset_relationships). - where(parent_swf_asset_relationships: { - parent_type: "Item", - parent_id: item_ids, - }) - } - scope :with_parent_ids, -> { - select('swf_assets.*, parents_swf_assets.parent_id') - } # To manually change the body ID without triggering the usual change to 0, # use this override method.