This is the original post:
I use ember 2.9.1 and ember data 2.9.0.
I have a simple model say 'users' which has 'name' and 'address' fields. When i query the model using findAll('user'), the data from server is right. But when i try to get the actual data(using toArray) from the recordArray returned, the data i get array of classes.
i.e., if i have two users, then i get an array of classes instead of the actual data i expect like([{name:"user1", address: "address1"},{name:"user2", address: "address2"}]) to give to the template.
Am i doing it right?
Edited post:
I use ember 2.9.1 and ember data 2.9.0.
I have a simple model named user which has
name
andaddress
fields. When I query the model usingstore.findAll('user')
, the data from server is right. But when I try to get the actual data(usingtoArray
) from therecordArray
returned, the returned data is an array of classes.i.e., if I have two
user
s, then I get an array of classes instead of the actual data I expect like ([{name:"user1", address: "address1"},{name:"user2", address: "address2"}]
) to give to the template.What am I doing wrong?
Original versus suggested changes:
- say 'users' which - named user which
- 'name' and 'address' -
name
andaddress
- Am i doing it right? - What am I doing wrong?
- i - I (in many places)
- all variables and code formatted with `` (in many places)
I believe that all the changes are acceptable. Is my assumption right? If so, how should I convince the OP? Can I point the OP to this answer?
[{name:"user1", address: "address1"},{name:"user2", address: "address2"}]
- not repeated twice in the edit version, it was my mistake so updated question. In emberfindAll
method will be called fromstore
. Actually, my intention is to get comments from Moderators for this edit since OP got disappointed due to this edit.`
) for a line of code, use code blocks instead (new line with four spaces).