Welcome to your first day of work at Jams Incorporated. Today, you are tasked with creating an application that can keep track of all the musicians that Jams Inc. produces.
Jams Inc. works with tens and tens of artists, so keeping track of their name
, age
and bio
is really important to the company.
In keeping tradition with RESTful routes, Jams Inc. wants you to build out the following deliverables:
-
A database of
Artists
that will allow for aname
string,age
integer andbio
string. If you created your database properly, you should be able to seed the database with the givenseeds.rb
file. -
An index page that displays the names of all the artists in your database.
- A nice to have feature: On the index page, clicking on the name of the artist would link me to their show page (see below).
-
A dynamically generated show page for a single artist that shows their
name
,age
andbio
. -
A form to log a new artist with their
name
,age
andbio
. After the form is submitted, the user should be redirected to the saved artist's show page.
After you meet these deliverables, save and commit your code. Celebrate a little because you have now finished the CR part of your CRUD application. Yay! ๐ฏ
After a little celebration, your manager comes up to you and asks if you can implement some more features. Eager to make your application bigger and better, you say yes. Here are some more deliverables that your manager wants you to build out:
-
A dynamically generated edit-form for a single artist that is auto populated with the selected artist's information. After the edit-form is submitted, the site should redirect the user back to the show page, showing the new updated information.
- A nice to have feature: On the artist's show page, have a link that will take the user to that artist's edit page.
-
A delete functionality that will be able to delete an artist from the database. This can be just a button on the artist's show page. When the button is clicked, the shown artist should be deleted and the webpage should be redirected to the index page of all the artists.
Save, commit and push your code! If you have met all these deliverables, you have accomplished CRUD for the Artist
model, which is not an easy feat. Celebrate a little! ๐
After celebrating, you might want to consider using a separate Artist controller, if you have already not implemented it. As your application grows and you have more and more models in your domain, having separate controllers will help you follow the Single Responsibility Principle.