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

findAll returns empty array always #120

Closed
igorrKurr opened this issue Jun 11, 2015 · 2 comments
Closed

findAll returns empty array always #120

igorrKurr opened this issue Jun 11, 2015 · 2 comments

Comments

@igorrKurr
Copy link

Hi!

I used this adapter in my app.
And i had such issue.

These steps i did to get it:
1 - setup adapter, serializer, create model
2 - i populate my localStorage manually. It contains

{"user":{"users":[{"firstName":"Telly","lastName":"Beatty","gender":"male","id":1}]}}

3 - call `this.store.find('user')

And I get empty array.

I briefly take look at localStorage adapter source and see this line https://github.com/kurko/ember-localstorage-adapter/blob/master/localstorage_adapter.js#L220.

Here .records property called on namespace.
And i got {users: [...]} hash from here https://github.com/kurko/ember-localstorage-adapter/blob/master/localstorage_adapter.js#L217, and it doesn't contains any records property.

So I think that problem is here, but maybe i did something wrong?

@igorrKurr
Copy link
Author

hi once again!

json i populated localStorage is wrong:

{"user":{"users":[{"firstName":"Telly","lastName":"Beatty","gender":"male","id":1}]}}

and should be:

{"user":{"records":{"1":{"id":"1","firstName":"Lavada","lastName":"Schumm","gender":"male"},"2":{"id":"2","firstName":"Kelton","lastName":"Vandervort","gender":"female"}}}}

My mistake, sorry 😬

@kurko
Copy link
Collaborator

kurko commented Jun 12, 2015

👍

@kurko kurko closed this as completed Jun 12, 2015
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

2 participants