diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/query.rb | 28 |
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 |