Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Find or create? #14

Closed
kittinunf opened this issue Jul 5, 2013 · 1 comment
Closed

Find or create? #14

kittinunf opened this issue Jul 5, 2013 · 1 comment

Comments

@kittinunf
Copy link

Firstly, I would like to say that your lib is lovely. It really empowers CD and wish that iOS SDK has bundled something like this in their framework.

Being on ror for quite some time, I tend to thing in a interface from rails.

After I use ObjectiveRecord for a while, I find myself using

Person* p = [[Person where:@{ @"id", @5}] first];
if (p) {
    [p update:data];
} else {
    p = [Person create:data];
}

all the time. My question is simple, do you have interface like 'findOrCreate' just to avoid this boring check?

@supermarin
Copy link
Owner

@kittinunv-taskworld that's a very good pointer - I've almost gone implementing that.

If you want, send a PR, otherwise just wait :)

xavierjurado added a commit to xavierjurado/ObjectiveRecord that referenced this issue Sep 18, 2013
supermarin pushed a commit that referenced this issue Sep 18, 2013
xavierjurado added a commit to xavierjurado/ObjectiveRecord that referenced this issue Sep 20, 2013
supermarin pushed a commit that referenced this issue Sep 21, 2013
Fix #14

Conflicts:
	Classes/NSManagedObject+ActiveRecord.h
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants