Creating and Styling Comments for YelpCamp

This week I finally I got to the comments section of the tutorials. In this section we took what we learned about data association and use that to create comments made by users. I first created a seeding file which would delete and create new campgrounds every time we ran our app. This is done so it can show how the comments created through the app become referenced in the Campgrounds collection in our database.

After creating our seed file I went over nested routes. Nested routes are routes that depend on IDs from objects in the database. Since I had to create a relation between the comments and the campgrounds, the comments needed the ID of the campground so that they will appear on the correct campground page. I also had to use the referencing data method to create this association.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *