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

can’t handle documents without type property #14

Open
gr2m opened this issue Jul 26, 2016 · 0 comments
Open

can’t handle documents without type property #14

gr2m opened this issue Jul 26, 2016 · 0 comments

Comments

@gr2m
Copy link
Member

gr2m commented Jul 26, 2016

the type property is optional at Hoodie, for example

hoodie.store.add({foo: 'bar'})

creates a document like this

{
  "foo": "bar",
  "updatedAt": "2016-07-26T23:44:14.429Z",
  "createdAt": "2016-07-26T23:44:14.429Z",
  "id": "95BE9F30-F217-F061-93FD-D3F9F5799CAD",
  "_rev": "1-fa563dd8cbff83f6e77d4c9b18a57980"
}

If I’d do the same in an app using ember-hoodie, I get this error

vendor.js:26604 Uncaught (in promise) EmberError {description: undefined, fileName: undefined, lineNumber: undefined, message: "Assertion Failed: You need to pass a model name to the store's normalize method", name: "Error"…}
ErrorEmberError @ ember.debug.js:15986
assert @ ember.debug.js:6488
assert @ ember.debug.js:15740
assert @ debug.js:14
normalize @ store.js:1959
update @ store.js:18
EventEmitter.emit @ hoodie.js:19125
triggerEvent @ hoodie.js:2656
(anonymous function) @ hoodie.js:2643

I’d suggest we simply ignore documents without a type property

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

No branches or pull requests

1 participant