diff --git a/app/controllers/item_zone_sets_controller.rb b/app/controllers/item_zone_sets_controller.rb index 92282c02..8bbb30fb 100644 --- a/app/controllers/item_zone_sets_controller.rb +++ b/app/controllers/item_zone_sets_controller.rb @@ -1,5 +1,5 @@ class ItemZoneSetsController < ApplicationController def index - render :json => Zone.all_plain_labels + render :json => Zone.for_items.all_plain_labels end end diff --git a/app/models/zone.rb b/app/models/zone.rb index c149156c..16c56f17 100644 --- a/app/models/zone.rb +++ b/app/models/zone.rb @@ -13,13 +13,14 @@ class Zone < ActiveRecord::Base t = Zone::Translation.arel_table includes(:translations).where(t[:plain_label].eq(Zone.plainify_label(label))) } + scope :for_items, lambda { where(arel_table[:type_id].gt(1)) } def uncertain_label @sometimes ? "#{label} sometimes" : label end def self.all_plain_labels - Zone.select([:id]).includes(:translations).all.map(&:plain_label).uniq.sort + select([:id]).includes(:translations).all.map(&:plain_label).uniq.sort end def self.plainify_label(label)