lib/aitch/ext/to_query.rb in aitch-1.2.2 vs lib/aitch/ext/to_query.rb in aitch-2.0.0

- old
+ new

@@ -68,14 +68,14 @@ # The string pairs "key=value" that conform the query string # are sorted lexicographically in ascending order. # # This method is also aliased as +to_param+. def to_query(namespace = nil) - collect do |key, value| + filter_map do |key, value| unless (value.is_a?(Hash) || value.is_a?(Array)) && value.empty? value.to_query(namespace ? "#{namespace}[#{key}]" : key) end - end.compact.sort! * "&" + end.sort! * "&" end alias to_param to_query end