lib/mongoid/elasticsearch/response.rb in mongoid-elasticsearch-0.3.0 vs lib/mongoid/elasticsearch/response.rb in mongoid-elasticsearch-0.3.1
- old
+ new
@@ -64,17 +64,11 @@
m.id = BSON::ObjectId.from_string(h['_id'])
m._id = m.id
m
end
when :model
- if @multi
- multi_without_load
- else
- hits.map do |h|
- model_from_hash(h)
- end
- end
+ multi_without_load
else
hits
end
end
@@ -116,15 +110,9 @@
results.size
end
alias_method :length, :size
private
- def model_from_hash(h)
- source = h.delete('_source')
- m = @model.new(h.merge(source))
- m.new_record = false
- m
- end
def find_klass(type)
raise NoMethodError, "You have tried to eager load the model instances, " +
"but Mongoid::Elasticsearch cannot find the model class because " +
"document has no _type property." unless type