-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
You can no longer create model fragments on their own using make or makeList #238
Comments
Boy, this is a tricky one. How about maybe set a flag like showMeTheIdPlease: true ? in the modelDefinition ?? |
or maybe use transient attributes and afterMake function |
Yeah, I know this is working as expected now so I don't necessarily expect it to be something that's supported. If it's a hacky fix I'd been inclined to leave it as is. One thing I did find when I was trying to make models inline in the test it didn't work as I expected it to. It seemed to be expected the property name to be the name of the factory which isn't the case. I'll try and add a test to replicate. I'll give that |
I wish I could understand why you need this kind of thing ( to make a fragment on it'd own ) .. and then put it in the store. I definitely make fragments in my tests but I always build them ( not make ) and then pass them to the model or whatever. |
Well I guess it's just a shortcut. The components I'm testing don't get passed the whole ember data model, just the model fragment. So in my tests rather than having to create the whole model we were just creating the fragment on its own using I can resolve it by just creating the parent ember model instead, but was just checking if you had any ideas for a workaround. I wouldn't waste time on supporting this as in fairness it is working as expected 😄 |
Going to close this as I don't think it's actionable |
Since 8e2dca2, which removes
id
s from model fragments, you can no longermake
ormakeList
model fragments on their own. This is something we do in some our component integration tests where the components operate solely on model fragments, rather than the whole model.Trying to do so results in the following error:
Assertion Failed: You must include an 'id' for ... in an object passed to 'push'
, I guess because we are trying to push models to the store which have noid
.I understand this is working as expected, and the way it worked before was probably a bit of a hack. We can get around the problem by creating the parent ember data model and accessing the fragments through that but requires a bit more work, e.g. setting up associations etc.
Unless you have any other ideas?
The text was updated successfully, but these errors were encountered: