From c8d109169ee995be9f4e16bd3667cce0a7d5111b Mon Sep 17 00:00:00 2001 From: Philipp Tessenow Date: Fri, 3 Jan 2014 13:18:21 +0100 Subject: [PATCH] do not use deprecated methods Query#values_for and Query#operator_for --- app/models/query.rb | 7 ++++--- app/views/queries/_filters.html.erb | 15 ++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/models/query.rb b/app/models/query.rb index d2daf2c451..1a1959dd7a 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -281,11 +281,12 @@ class Query < ActiveRecord::Base project_clauses = [] if project && !project.descendants.active.empty? ids = [project.id] - if has_filter?("subproject_id") - case operator_for("subproject_id") + subproject_filter = filter_for 'subproject_id' + if subproject_filter + case subproject_filter.operator when '=' # include the selected subprojects - ids += values_for("subproject_id").each(&:to_i) + ids += subproject_filter.values.each(&:to_i) when '!*' # main project only else diff --git a/app/views/queries/_filters.html.erb b/app/views/queries/_filters.html.erb index db387178e8..246b0ca2a3 100644 --- a/app/views/queries/_filters.html.erb +++ b/app/views/queries/_filters.html.erb @@ -117,25 +117,26 @@ Event.observe(document,"dom:loaded", apply_filters_observer); <%= label_tag "op_#{field}", l(:description_filter), :class => "hidden-for-sighted" %> - <%= select_tag "op[#{field}]", options_for_select(operators_for_select(options[:type]), query.operator_for(field)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %> + <%= select_tag "op[#{field}]", options_for_select(operators_for_select(options[:type]), query.filter_for(field).try(:operator)), :id => "operators_#{field}", :onchange => "toggle_operator('#{field}');", :class => "select-small", :style => "vertical-align: top;" %>