From 40278afd0c14c7139b34bac8bb3fb48589f39563 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Wed, 24 Jan 2024 06:12:03 -0800 Subject: [PATCH] Add find_by_name method to AltStyle --- app/models/alt_style.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/models/alt_style.rb b/app/models/alt_style.rb index 3aedd61f..23386ddc 100644 --- a/app/models/alt_style.rb +++ b/app/models/alt_style.rb @@ -19,4 +19,11 @@ class AltStyle < ApplicationRecord SwfAsset.from_biology_data(self.body_id, asset_data) end end + + # For convenience in the console! + def self.find_by_name(color_name, species_name) + color = Color.find_by_name(color_name) + species = Species.find_by_name(species_name) + where(color_id: color, species_id: species).first + end end