remove warnings on each environment boot about modifying StandardBodyIds

This commit is contained in:
Emi Matchu 2011-05-13 08:26:06 -04:00
parent 9057f56e2e
commit 27f3111b65

View file

@ -12,9 +12,10 @@ class PetType < ActiveRecord::Base
BasicHashes = YAML::load_file(Rails.root.join('config', 'basic_type_hashes.yml'))
StandardPetTypesBySpeciesId = PetType.where(arel_table[:color_id].in(Color::BasicIds)).group_by(&:species_id)
StandardBodyIds = []
StandardBodyIds = [].tap do |body_ids|
StandardPetTypesBySpeciesId.each do |species_id, pet_types|
StandardBodyIds += pet_types.map(&:body_id)
body_ids.concat(pet_types.map(&:body_id))
end
end
# Returns all pet types of a single standard color. The caller shouldn't care