lib/rfm/utilities/compound_query.rb in ginjo-rfm-2.1.6 vs lib/rfm/utilities/compound_query.rb in ginjo-rfm-2.1.7
- old
+ new
@@ -20,11 +20,11 @@
# * array of find-criteria hashes
#
# Returns self as ['-fmpaction', {:hash=>'of', :key=>'values'}, {:options=>'hash'}]
def initialize(query, options={})
@options = options
- @field_mapping = options.delete(:field_mapping)
+ @field_mapping = options.delete(:field_mapping) || {}
@original_input = query
@key_values = {}
@key_arrays = []
@key_map = []
@key_map_string = ''
@@ -75,10 +75,10 @@
omit = input_hash.delete(:omit)
input_hash.each do |key,val|
query_tag = []
val = val.rfm_force_array
val.each do |v|
- @key_values["-q#{key_counter}"] = field_mapping.invert[key] || key
+ @key_values["-q#{key_counter}"] = field_mapping[key] || key
@key_values["-q#{key_counter}.value"] = v
query_tag << "q#{key_counter}"
@key_counter += 1
end
keyarray << query_tag