Finished Ruby on Rails, but still confused on some things, help?


#1

So I went through the whole course, and for the most part I understand it, and with some more practice, I will get better. Something that bothered me was I didn't know where the content of the websites I made through the course came from. There was a lot of images and content, like movie names, actor names, bio's of the actors and plots of the movies etc and I couldn't find where they were coming from. Does anyone know? did they come from some server somewhere or what? I'm confused.


#2

Hey Stephen,

The movie names, actor names, etc., are just text, which are being stored right there in our Rails app. The only thing being stored elsewhere is the images, Which come from a URL like:

http://s3.amazonaws.com/codecademy-content/projects/[section number]/[project name]/[image].jpg

(unfortunately, not using HTTPS even though AWS lets them).
If you look in the seeds.rb file, you'll see a bunch of stuff, for example:

a1 = Album.create(cover: "http://s3.amazonaws.com/codecademy-content/projects/3/bass-music/my-beautiful-dark-twisted-fantasy.jpg", title: "My Beautiful Dark Twisted Fantasy", artist: "Kanye West")
Track.create(name: "Dark Fantasy", minutes: 5, album_id: a1.id)
# more tracks

a2 = Album.create(cover: "http://s3.amazonaws.com/codecademy-content/projects/3/bass-music/beyonce.png", title: "Beyonce", artist: "Beyonce")
Track.create(name: "Pretty Hurts", minutes: 5, album_id: a2.id)
# more tracks

So you can see how when they seed the database, they're linking to an external resource for the cover image.
I wish they would've had us do some file uploads, though. That would've been fun :)