From 629ff2c45d926944296c335c30ee9642b214d1e0 Mon Sep 17 00:00:00 2001 From: Matchu Date: Mon, 28 Jan 2013 17:54:50 -0600 Subject: [PATCH] index items by *actual* species support ids --- 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 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