filter deserialisation fix

pull/6200/head
Markus Kahl 7 years ago
parent a8a36b1edb
commit 607f2740ae
  1. 6
      app/models/queries/filter_serializer.rb

@ -34,7 +34,11 @@ module Queries::FilterSerializer
def self.load(serialized_filter_hash) def self.load(serialized_filter_hash)
return [] if serialized_filter_hash.nil? return [] if serialized_filter_hash.nil?
(YAML.load(serialized_filter_hash) || {}).each_with_object([]) do |(field, options), array| # yeah, dunno, but apparently '=' may have been serialized as a Syck::DefaultKey instance...
yaml = serialized_filter_hash
.gsub('!ruby/object:Syck::DefaultKey {}', '"="')
(YAML.load(yaml) || {}).each_with_object([]) do |(field, options), array|
options = options.with_indifferent_access options = options.with_indifferent_access
filter = filter_for(field, true) filter = filter_for(field, true)
filter.operator = options['operator'] filter.operator = options['operator']

Loading…
Cancel
Save