index items by *actual* species support ids
This commit is contained in:
parent
2cc688f7ff
commit
629ff2c45d
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue