Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Ember.js Models Loading Arrays of JavaScript objects

...for anyone needing the text in store.js

I am working on this in Sublime and couldn't seem to find a download for the store.js files...so I typed it out. Pasting below...

var posts = [ { id: '1', title: "I love blood", body: "I awoke in my own bed. If it be that I had not dreamt, the Count must have carried me here. I tried to satisfy myself on the subject, but could not arrive at any unquestionable result. To be sure, there were certain small evidences, such as that my clothes were folded and laid by in a manner which was not my habit. My watch was still unwound, and I am rigorously accustomed to wind it the last thing before going to bed, and many such details. But these things are no proof, for they may have been evidences that my mind was not as usual, and, for some cause or another, I had certainly been much upset. I must watch for proof. Of one thing I am glad. If it was the Count who carried me here and undressed me, he must have been hurried in his task, for my pockets are intact. I am sure this diary would have been a mystery to him which he would not have brooked. He would have taken or distroyed it. As I look around this room, although it has been to me so full of fear, it is now a sort of sanctuary, for nothing can be more dreadful than those aweful women, who were, who are, waiting to suck my blood." }, { id: '2', title: "The Count", body: "I have given the letters. I threw them through the bars of my window with a gold piece, and made what signs I could to have them posted. The man who took them pressed them to his heart and bowed, and then put them in his cap. I could do no more. I stole back to the study, and began to read. As the Count did not come in, I have written here." }, { id: '3', title: "Thievery", body: "Every scrap of paper was gone, and with it all my notes, my memoranda, relating to railways and travel, my letter of credit, in fact all that might be useful to me were I once outside the castle. I sat and pondered awhile, and then some thought occurred to me, and I made search of my portmanteau and in the wardrobe where I had placed my clothes." } ];

var comments = [ { id: '1', postId: '3', text: 'What a shame!' }, { id: '2', postId: '3', text: 'I am so sorry. How are you feeling now?' }, { id: '3', postId: '1', text: 'I love blodd too!' }, { id: '4', postId: '1', text: 'Eeew, blood is gross.' }, { id: '5', postId: '2', text: 'This all sounds so mysterious.' } ]

Qa'id Jacobs
Qa'id Jacobs
12,210 Points

[UPDATE APR-05-2016: link fixed]
Thanks, Eric, you just saved me lots of time!

For anyone who wants the text with indentation and spacing, I have made a Github Gist of store.js.

BTW - Andre Kovac's text below is essentially the same with a more compact presentation.

Andre Kovac
Andre Kovac
5,588 Points

Thanks Eric Follows ! Great Stuff!

Qa'id Jacobs: The link to the Github Gist is unfortunately not working.

Here a formatted Version of @Eric Follows entry:

var posts = [
  { id: '1',
    title: "I love blood",
    body: "I awoke in my own bed. If it be that I had not dreamt, the Count must have carried me here. I tried to satisfy myself on the subject, but could not arrive at any unquestionable result. To be sure, there were certain small evidences, such as that my clothes were folded and laid by in a manner which was not my habit. My watch was still unwound, and I am rigorously accustomed to wind it the last thing before going to bed, and many such details. But these things are no proof, for they may have been evidences that my mind was not as usual, and, for some cause or another, I had certainly been much upset. I must watch for proof. Of one thing I am glad. If it was the Count who carried me here and undressed me, he must have been hurried in his task, for my pockets are intact. I am sure this diary would have been a mystery to him which he would not have brooked. He would have taken or distroyed it. As I look around this room, although it has been to me so full of fear, it is now a sort of sanctuary, for nothing can be more dreadful than those aweful women, who were, who are, waiting to suck my blood." },
  { id: '2',
    title: "The Count",
    body: "I have given the letters. I threw them through the bars of my window with a gold piece, and made what signs I could to have them posted. The man who took them pressed them to his heart and bowed, and then put them in his cap. I could do no more. I stole back to the study, and began to read. As the Count did not come in, I have written here." },
  { id: '3',
    title: "Thievery",
    body: "Every scrap of paper was gone, and with it all my notes, my memoranda, relating to railways and travel, my letter of credit, in fact all that might be useful to me were I once outside the castle. I sat and pondered awhile, and then some thought occurred to me, and I made search of my portmanteau and in the wardrobe where I had placed my clothes." }
];

var comments = [
  { id: '1', postId: '3', text: 'What a shame!' },
  { id: '2', postId: '3', text: 'I am so sorry. How are you feeling now?' },
  { id: '3', postId: '1', text: 'I love blodd too!' },
  { id: '4', postId: '1', text: 'Eeew, blood is gross.' },
  { id: '5', postId: '2', text: 'This all sounds so mysterious.' }
];

Thanks, Eric.

5 Answers

Thanks!

thanks..

Danke!

my heros

shemaiah cox
shemaiah cox
5,722 Points

Thanks, much appreciated guys.