In Rails, you'll be running the same commands in terminal to generate different things (models, controllers etc). The idea is to practice by repeating this process for several different projects and we'll be doing this for most of today.
We would like you to rip off your favorite websites (GoodReads, IMDB, etc - something where you can mimic a simple version of their database). No need to overdo it - just start simple and go from there. This is about the process rather than creating an awesome web-app.
It’s also important to understand what we are doing in each step, so don’t just follow these blindly. Try to tie these back to a visual representation of Rails and MVC, and feel free to ask me about that if you need. There are many web tutorials that can help you to visualize the pattern.
The idea here is to run through these steps several times until you have the pattern down totally. It’s also designed to have you run into the errors. Please read the errors each time they arise (they are there to help) and get very comfortable reading the errors. If you do, quite often you will have an understanding of what needs to be done without looking at this checklist.
If you can complete this checklist without referring to it, then you have the basics of Rails down:
- Create a new Rails project (and create your database)
- Configure an index route (‘/movies’)
- Generate the appropriate controller
- Generate the appropriate controller method
- Make the required views
- Generate a Movie model (with title, genre, year as the attributes)
- Migrate
- Use Rails console to add at least 3 movies (rows) to the table in your database
- Change the controller to talk to the model
- Amend the HTML with the correct erb to display just the title and genre
- Repeat these steps as needed