You've been tasked with building a Rails app called Beats by Rails, the app will need to have three separate models:
The data relationship will look something like this:
A song belongs to an artist
A song belongs to a genre
A genre has many songs
An artist has many songs
The tests are in the
spec/features directory for each model. You will need to build in the ability to
show for each model. And for the song
show page you need to have it display each of the song's genre and artist, and link to the respective genre and artist
The database tables should look like this (note each column type):
table "artists" string "name" text "bio" table "genres" string "name" table "songs" string "name" integer "artist_id" integer "genre_id"
You will need to use strong params
Don't worry about integrating drop down form elements for the genre and artist selections on the song form pages yet, simply enter in the ID in for each element
You can use the
controller generators, but do not use the
Top Tip: Remember to use the --no-test-framework flag when generating models and controllers to avoid generating unnecessary testing frameworks!
View CRU with form_for Lab on Learn.co and start learning to code for free.
View CRU Rails Lab on Learn.co and start learning to code for free.