-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Unable to create record once find has been called #2150
Comments
Sounds like a bug, but maybe for now you can use store.getById('MyModel', id) wich is synchronous and return the record if in the store, and null if not. |
I'm believe to have the same issue with ember 1.7.0, ember-data.beta-10 and emberFire 1.2.6.
results in
|
im not sure this is a bug, if a request fails we still have a model.. You must either unload it or reuse it. Maybe in the case of find, we can prevent this. |
@stefanpenner, ok. How would you unload it? Unsure how to handle (unloadRecord()). Continuing my example above, I tried the following without any luck.
|
@oskarrough I got the same issue, by looking here : #1523 I discovered the method : @store.recordForId(type, properties.id) the process is: |
I am using FixtureAdapter for testing. I am trying to achieve the following:
find in the store if a model with certain id
if such model exist, it is used for processing
otherwise, a new model with that id is created for processing
However, what I get is an error:
Error: Assertion Failed: The id foo has already been used with another record of type MyModel.
After tracing the Ember Data code, I found that:
foo
foo
:foo
foo
record in store.idToRecord created by store.find previouslyThere is a similar issue in emberFire. My temporary workaround is to call
store.dematerializeRecord
beforestore.createRecord
and it is obviously undesirable becausestore.dematerializeRecord
is non-public.The text was updated successfully, but these errors were encountered: