1
0
Fork 0
forked from OpenNeo/impress

index items by *actual* species support ids

This commit is contained in:
Emi Matchu 2013-01-28 17:54:50 -06:00
parent 2cc688f7ff
commit 629ff2c45d

View file

@ -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