diff --git a/app/models/item.rb b/app/models/item.rb index 803bfb87..e5e8bcee 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -47,7 +47,7 @@ class Item < ActiveRecord::Base indexed_attributes = { :is_nc => self.nc?, :is_pb => self.pb?, - :species_support_id => self.species_support_ids, + :species_support_id => self.supported_species_ids, :occupied_zone_id => self.occupied_zone_ids, :restricted_zone_id => self.restricted_zone_ids, :name => {} @@ -198,6 +198,10 @@ class Item < ActiveRecord::Base species_ids.size > 1 ? Species.all : Species.find(species_ids) end + def supported_species_ids + supported_species.map(&:id) + end + def support_species?(species) species_support_ids.blank? || species_support_ids.include?(species.id) end