lib/mebla/result_set.rb in mebla-1.1.4 vs lib/mebla/result_set.rb in mebla-1.1.5

- old
+ new

@@ -43,26 +43,26 @@ unless model_ids[model_class] model_ids[model_class] = [] end # collect ids # {class => [ids]} - model_ids[model_class].push hit['_source']['id'] + model_ids[model_class] << hit['_source']['id'] end end # Cast the results into their appropriate classes @entries = [] - - model_ids.each do |model_class, ids| + + model_ids.each_pair do |model_class, ids| unless model_class.embedded? # Retrieve the results from the database @entries += model_class.any_in(:_id => ids).entries else # Get the parent parent_class = model_class.embedded_parent access_method = model_class.embedded_as - ids.each do |parent_id, entries_ids| + ids.each_pair do |parent_id, entries_ids| parent = parent_class.find parent_id # Retrieve the results from the database @entries += parent.send(access_method.to_sym).any_in(:_id => entries_ids).entries end \ No newline at end of file