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

Use typeKey for relationship instead of attribute name for build fixture relationship #66

Conversation

cristinawithout
Copy link
Contributor

When building a fixture with relationships, FactoryGuy.build() is called with the relationship attribute name rather than that attributes model type.

It currently works only when relationship attributes have the same name as the model type they're related to.

So this works:
User = DS.Model.extend({
company: DS.belongsTo('company',)
});

But this doesn't:
User = DS.Model.extend({
default_company: DS.belongsTo('company',)
});

Build tries to find a factory named 'default_company' rather than the 'company' factory.

danielspaniel added a commit that referenced this pull request Feb 25, 2015
Use  typeKey for relationship instead of attribute name for build fixture relationship
@danielspaniel danielspaniel merged commit 276df5a into adopted-ember-addons:master Feb 25, 2015
@danielspaniel
Copy link
Collaborator

Thanks Christina for fixing that up. Can't believe I did not see that before. If you want me to make new version that has this change let me know and I will bump to v0.9.11

@cristinawithout
Copy link
Contributor Author

Thanks. Up to you if you want to bump the version. We can point to the SHA until there's a new version.

@cristinawithout cristinawithout deleted the relationship-typekey branch March 3, 2015 00:25
@danielspaniel
Copy link
Collaborator

@cristinawithout .. version 0.9.11 was released a few days ago .. fyi
also, I noticed that you have made the ember-cli-factory-guy package an ember-addon.
2 questions.
How ( when using as add on ) .. do you update the version of ember-data-factory-guy?
I it better to keep your project or make mine into an addon ( basically merging what your project has into mine )
I was just about to embark on making mine into an addon when I noticed you already did that. Anyway .. alittle confused since there are so many ways to use factory-guy. I just include it in my ember-cli bower.json and others use your addon ( adding to package.json ) ( which I think is great by the way ) .. so I thought it might be nice to have just one package ( ember-data-factory-guy ) and then use it this way or that .. if you know what I mean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants