> On Sep 30, 2014, at 8:25 AM, Martin Palatnik <[email protected]> wrote:
>
> I'm trying to check is a CBLModel is new (never being saved). However isNew
> is always false.
> When I checked the code it makes sense because I'm passing to it a non null
> document. However that document is new as it was just created.
.isNew will return YES if the model was created by
-initWithNewDocumentInDatabase:, but not if it was created with
+modelForDocument:, even if the document has no revisions. That's arguably a
bug.
A reliable test that will do what you want is
model.document.currentRevision != nil
—Jens
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/A11A31EE-476C-4903-8BAD-A6299A168210%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.