Associations I
Use assocations to model one-to-many relationships.
StartAssociations I
Lesson 1 of 1
- 1We built a Rails app that stores data using a single model. What if we want to build an app with more than one kind of data, like Team and Athlete? Both Team and Athlete would have have different …
- 4Nice work. What did we just do? 1. We added two string columns title and image to the tags table 2. We added three string columns name, image, and description to the destinations table 3. We also …
- 5Well done! The app now displays a list of tags from the database.
- 6Nice job! The app displays all destinations that belong to a tag. How does this work? - When a user visits http://localhost:8000/tags/1, the route get ‘/tags/:id’ => ‘tags#show’ sends this request…
- 7Great! The app now displays a specific destination. Let’s continue by adding actions to update a destination’s name and description. Looking at the seven standard Rails actions, we need to use the…
- 8Nicely done! You can now update a destination’s name and description. How does it work? When you visit http://localhost:8000/destinations/1/edit to edit a destination, it triggers the first turn o…
- 9Congratulations! You built an travel app that uses a database to store two kinds of data. What can we generalize so far? - We connected a Tag to its Destinations using associations. In this case…
What you'll create
Portfolio projects that showcase your new skills
How you'll master it
Stress-test your knowledge with quizzes that help commit syntax to memory