lib/inquisitio/searcher.rb in inquisitio-0.0.13 vs lib/inquisitio/searcher.rb in inquisitio-0.1.0

- old
+ new

@@ -25,19 +25,19 @@ def search results end def ids - @ids ||= map{|r|r['med_id']} + @ids ||= map{|r|r['data']['med_id'].first}.flatten.map(&:to_i) end def records @records ||= begin klasses = {} map do |result| - klass = result['med_type'] + klass = result['data']['med_type'].first klasses[klass] ||= [] - klasses[klass] << result['med_id'] + klasses[klass] << result['data']['med_id'].first end klasses.map {|klass, ids| klass.constantize.where(id: ids) }.flatten