couchrest / couchrest_model

Doing the simple stuff so you don't have to
Apache License 2.0
304 stars 116 forks source link

reloading a deleted doc raises NoMethodError #222

Closed azul closed 6 years ago

azul commented 7 years ago

The following code raises NoMethodError undefined method `each' for nil:NilClass

doc = Model.find(id)
dup = Model.find(id)
doc.destroy
dup.reload

I understand that inside it performs a get ... which returns nil and then tries to enumerate nils attributes. But this is a very strange error to catch on a reload. A NotFound Error would make a lot more sense.