ddd_sample_app_ruby icon indicating copy to clipboard operation
ddd_sample_app_ruby copied to clipboard

Persisting Cargo needs improvement

Open paulrayner opened this issue 12 years ago • 2 comments

Currently the store method in CargoRepository does a find first, then a delete if it finds a document. It does this because it had trouble detecting that a Cargo document already existing when doing an update after the Delivery object had been updated.

There should be a way to make this work without the find and delete step, and without having to store an extra Mongoid attribute in Cargo.

paulrayner avatar Jun 10 '13 04:06 paulrayner

Can't you do a Cargo create within a rescue block? It's not ideal but that would work and would save you the "find + delete + create" dance.

drsharp avatar Aug 28 '14 18:08 drsharp

Sure. I'll try that. Thanks.

paulrayner avatar Aug 28 '14 23:08 paulrayner