summaryrefslogtreecommitdiffstats
path: root/app/models/query.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/query.rb')
-rw-r--r--app/models/query.rb28
1 files changed, 16 insertions, 12 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 23eca0278..a0f1969e3 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -387,19 +387,23 @@ class Query < ActiveRecord::Base
end
def as_params
- params = {}
- filters.each do |field, options|
- params[:f] ||= []
- params[:f] << field
- params[:op] ||= {}
- params[:op][field] = options[:operator]
- params[:v] ||= {}
- params[:v][field] = options[:values]
+ if new_record?
+ params = {}
+ filters.each do |field, options|
+ params[:f] ||= []
+ params[:f] << field
+ params[:op] ||= {}
+ params[:op][field] = options[:operator]
+ params[:v] ||= {}
+ params[:v][field] = options[:values]
+ end
+ params[:c] = column_names
+ params[:sort] = sort_criteria.to_param
+ params[:set_filter] = 1
+ params
+ else
+ {:query_id => id}
end
- params[:c] = column_names
- params[:sort] = sort_criteria.to_param
- params[:set_filter] = 1
- params
end
def validate_query_filters