To practice the skills you’ve learned in this activity, solve the following problem.
Consider this model class design:
Add a new model class to the app that follows this design.
Take a screenshot that includes the terminal showing the rails generate command and its output.
Use the seeds.rb script to add the following seed data to the app:
Ford, F-150 Lightning, 2023, Silver
Toyota, Prius Prime, 2023, Blue
Chevrolet, Corvette, 2022, Blue
Toyota, Camry, 2021, Red
Take a screenshot that includes the VS Code editor showing the completed seeds.rb file.
In the Rails console, retrieve all four model objects (no order specified), and print the year, color, and make of each.
Take a screenshot that includes the Rails console showing the Ruby code you entered and its output.
HINT: When printing, you may need to convert the integer attribute year to a string with the to_s method (e.g., my_car.year.to_s).
In the Rails console, retrieve all four model objects sorted in ascending order first by make and second by year, and print the year, color, and make of each.
Take a screenshot that includes the Rails console showing the Ruby code you entered and its output.
Submit your screenshots in the designated Canvas assignment.
I strongly recommend that you attempt the following problems on your own; however, if you get stuck, you can refer to the following video demonstration for help: