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 trialUnsubscribed User
8,838 PointsHow do you get the original arrays?
In the Ember.js course, Michael creates a new file called store.js. The file already has a lot of code in it and I can't get this. It kind of prevents me from going further, unless I have to copy it all out from the video. Which would be hard.
Thanks to anyone who can help!
2 Answers
Iain Simmons
Treehouse Moderator 32,305 PointsSo I followed the clues from the vampire theme and found that the posts in store.js are paragraphs from Chapter 4 of Bram Stoker's Dracula.
Here's a complete store.js
(I retyped the comments myself from pausing the video as he scrolls through):
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 that the Count 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 destroyed it. As I look round 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 awful 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 blood too!'
},
{
id: '4',
postId: '1',
text: 'Eeew, blood is gross.'
},
{
id: '5',
postId: '2',
text: 'This all sounds so mysterious.'
}
];
Hope this helps you and anyone else wondering the same thing!
Keith Kelly
21,326 PointsI am not sure where Michael got the code he is using, but if you need JSON placeholder information you can find it at JSON placeholder
There is even a specific set of post JSON with the same setup JSON posts
Unsubscribed User
8,838 PointsUnsubscribed User
8,838 PointsThank you so much! This really helped!
Thomas McCracken
13,591 PointsThomas McCracken
13,591 PointsThanks Iain! really cool of you to do this!