From e71530a95862a8fae98365d65674abd0de86b83a Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 5 Feb 2013 11:52:52 -0600 Subject: [PATCH] only show item zones on outfits#edit occupies filter helper --- app/controllers/item_zone_sets_controller.rb | 2 +- app/models/zone.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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)