lib/mebla/result_set.rb in mebla-1.1.0 vs lib/mebla/result_set.rb in mebla-1.1.1

- old
+ new

@@ -59,13 +59,15 @@ else # Get the parent parent_class = model_class.embedded_parent access_method = model_class.embedded_as - parent = parent_class.find ids.keys.first - - # Retrieve the results from the database - @entries += parent.send(access_method.to_sym).any_in(:_id => ids.values.first).entries + ids.each 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 end end Mebla.log("WARNING: Index not synchronized with the database; index total hits: #{@total}, retrieved documents: #{self.count}", :warn) if @total != self.count end \ No newline at end of file