Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create with includes #1838

Closed
bluecenter opened this issue May 30, 2014 · 13 comments
Closed

Create with includes #1838

bluecenter opened this issue May 30, 2014 · 13 comments
Labels
type: feature For issues and PRs. For new features. Never breaking changes.

Comments

@bluecenter
Copy link

two objects A, B, one-on-one relationship. create A first and create B right after with include as options to reload A in B, however it does not work. Have to use find to populate the relationship.

@mickhansen
Copy link
Contributor

Could you provide a self contained test case?

@bluecenter
Copy link
Author

options = {include: [model: A as: a ]}
A.create
sucess
B.create(values, options)
success(function(b) {
should see b.a here but not
}

@mickhansen mickhansen added the Bug label Jun 2, 2014
@mickhansen
Copy link
Contributor

Your test case doesn't really include any reloads. Also include isn't supported for create afaik.

@mickhansen
Copy link
Contributor

Although it should work since build supports includes.

@bluecenter
Copy link
Author

Sorry, actually it is not reload, it is include. So in options there is include, which should load A into B as 'a', after B is created.

@mickhansen
Copy link
Contributor

That is not supported, so changing issue to a feature request.
Your example doesn't quite describe how you expect this to happen either.
You are creating B with what exactly? Please provide more clear code examples so we can get an idea of how this feature would work.

@mickhansen mickhansen changed the title reload does not work on create Create with includes Jun 10, 2014
@bulkan
Copy link
Contributor

bulkan commented Jul 14, 2014

The API reference for create() suggests that the options object passed in can have a include property that is an array of models.

Is the api reference incorrect ?

@mickhansen
Copy link
Contributor

@bulkan yes and no. The option is mentioned because it's supported by build() to build the associations if coming from a cache or similar. Creating instances + nested relations in one go is not supported currently. However it's a high priority to get that feature in (it greatly simplifies testing setups aswell).

@bluecenter
Copy link
Author

Sorry I missed this notification and see it today, thank you.

@dcohenb
Copy link

dcohenb commented Jan 29, 2015

+1 on this

@janmeier
Copy link
Member

@mickhansen This can be closed now, right?

@mickhansen
Copy link
Contributor

Yes I think so.
On 24 Mar 2015 16:09, "Jan Aagaard Meier" notifications@github.com wrote:

@mickhansen https://github.com/mickhansen This can be closed now, right?


Reply to this email directly or view it on GitHub
#1838 (comment)
.

@mickhansen
Copy link
Contributor

#3386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature For issues and PRs. For new features. Never breaking changes.
Projects
None yet
Development

No branches or pull requests

5 participants