genkgo / ember-localforage-adapter

Offline usage for Ember Data, based on localstorage adapter, but now uses Mozilla's localforage as data source
Other
133 stars 26 forks source link

TypeError: Invalid fullName: `model:@each`, must be of the form `type:name` #16

Closed RuslanZavacky closed 9 years ago

RuslanZavacky commented 9 years ago

I've installed addon, created adapter & model. I am using pods for structure:

I've created: app/pods/application/cache/adapter.js

import LFAdapter from 'ember-localforage-adapter/adapters/localforage';

export default LFAdapter.extend({
  namespace: 'user',
  caching: 'all'
});

app/pods/application/cache/model.js

import DS from 'ember-data';

export default DS.Model.extend({
  key: DS.attr('string'),
  value: DS.attr('string')
});

Then trying to do search:

this.store.find('application/cache', 'zip-code').then(function(data) {
    console.log('data from local', data);
});

When application starts I see a bunch of warning in the console:

WARNING: Encountered "_super" in payload, but no model was found for model name "super" (resolved model name using vetoza-ui@serializer:application:.typeForRoot("_super"))
ember.debug.js:3956 WARNING: Encountered "nextObject" in payload, but no model was found for model name "nextObject" (resolved model name using vetoza-ui@serializer:application:.typeForRoot("nextObject"))
ember.debug.js:3956 WARNING: Encountered "firstObject" in payload, but no model was found for model name "firstObject" (resolved model name using vetoza-ui@serializer:application:.typeForRoot("firstObject"))
...

And an error in the end

 TypeError: Invalid fullName: `model:@each`, must be of the form `type:name` 
    at __exports__.default.EmberObject.extend.resolve (ember.debug.js:3662)
    at Object.resolve [as resolver] (ember.debug.js:3468)
    at resolve (ember.debug.js:1744)
    at Object.Container.resolve (ember.debug.js:1315)
    at factoryFor (ember.debug.js:1837)
    at Object.Container.lookupFactory (ember.debug.js:1422)
    at Ember.Object.extend.modelFactoryFor (store.js:1326)
    at ember$data$lib$serializers$json_serializer$$default.extend.extractSingle (rest_serializer.js:271)
    at Ember.Object.extend.extractFind (json_serializer.js:855)
    at Ember.Object.extend.extract (json_serializer.js:724)

Any clue, what might cause this?

frederikbosch commented 9 years ago

To be honest, I have no experience with pods. The error are a littile familiar: since Ember beta 14 you will be seeing warnings when you are setting a property that is not part of the model. I am afraid I cannot be of help here.

RuslanZavacky commented 9 years ago

@frederikbosch do you have any gist/jsbin on how this addon is working? As its seems really strange...

When you try to update record, first need to find it. If record is not found, its anyway says as it is found.

Then to update such "ghost" record need to actually create it. After you've created it, its not possible to update it.

Am I only one who have such problems? Or I am one who is trying to use this addon with ember-cli?

RuslanZavacky commented 9 years ago

I've solved the riddle :)

frederikbosch commented 9 years ago

Well, that is great. Could you post the solution? Perhaps you are helping other users when they have the same issue. Then I can close it too.

RuslanZavacky commented 9 years ago

@frederikbosch I'll contribute to the README in following days :)

frederikbosch commented 9 years ago

That would be great!

frederikbosch commented 9 years ago

Any news on this? :)

RuslanZavacky commented 9 years ago

@frederikbosch give me a couple more days, I have it on roadmap :)