From f484fc5c215acb9faf185e0f9f4d7a149686ee58 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 28 Jan 2013 16:54:25 -0600 Subject: [PATCH] update supported species list on items#show --- app/models/item.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/item.rb b/app/models/item.rb index bcb4dfb7..803bfb87 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -187,11 +187,15 @@ class Item < ActiveRecord::Base def supported_species body_ids = swf_assets.select([:body_id]).map(&:body_id) + return Species.all if body_ids.include?(0) pet_types = PetType.where(:body_id => body_ids).select([:species_id]) species_ids = pet_types.map(&:species_id).uniq - Species.find(species_ids) + + # If there are multiple known supported species, it probably supports them + # all. (I've never heard of only a handful of species being supported :P) + species_ids.size > 1 ? Species.all : Species.find(species_ids) end def support_species?(species)