Re: getting to know Mr. ERXRoute
Re: getting to know Mr. ERXRoute
- Subject: Re: getting to know Mr. ERXRoute
- From: Pascal Robert <email@hidden>
- Date: Fri, 31 Dec 2010 08:17:10 -0500
Le 2010-12-30 à 14:48, Jesse Tayler a écrit :
> My understanding of ERRestRouteExample seems ok.
>
> I can create a new Pet and tie it to a person in ERRestRouteExample:
>
>
> curl -X POST -d "{ name:'Rover', owner: { type:'Person', id:1 } }" http://Jesse-Taylers-iMac.local:5999/cgi-bin/WebObjects/RESTExample.woa/ra/Pet.json
>
>
> I can create a new Person in my own model, but when I try to create a new Post and tie it to that user, I have either one of two possible troubles:
>
>
> curl -X POST -d "{ title:'A Title', author: { type:'User', id:1 } }" http://Jesse-Taylers-iMac.local:5999/cgi-bin/WebObjects/WOMan.woa/ra/Mtly.json
>
>
> It either produces an error from the EO init while trying to set the author:
>
>
> setAuthorRelationship((User) ((User)ERCoreBusinessLogic.actor()).localInstanceIn(editingContext()))
You shouldn't need to set the relationship in your route method, does your "Post" EO have a relation named "Author" which links to a User?
>
> Or if I don't use that method, I get an error from validation?
>
> A <b>Mtly</b> must have a <b>Author</b>.
>
>
> Surely, I am mixing things?
>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden