Creating a Single Resource Lab
Setup
For today’s lab, you’re going to continue building on your Record Collection application.
Objective: Add a form to create a new album and thoroughly test this new feature.
- Open your Record Collection project.
- If you have been absent, follow these steps:
- Fork and Clone it from this Starter Repository.
- Create the database by running
update-database
from the Package Manager Console. - Open the database in pgAdmin, and create some records by running the following script (feel free to update the albums and artists to your favorites!).
INSERT INTO albums (title, artist, release_date) VALUES ('Stop Making Sense', 'Talking Heads', '1984-06-24'), ('Banana Winds', 'Jimmy Buffet', '1996-12-06')
- Build the project, and let an instructor know if you receive any errors.
- If you have been absent, follow these steps:
Diagramming
Before diving into code, we’re going to create a plan for what we want to build.
With your partner: Take 15 minutes to draw the following two diagrams.
-
Draw a UI wireframe of what you want your form to look like for adding a new album. What input fields will you have?
-
Draw a request/response diagram, similar to the one we drew as a class during the lesson, for your add album form.
Building
- Create
/albums/new
- Start by building a form for creating an album and making it so that when a user visits
/albums/new
they are directed to your form.
- Start by building a form for creating an album and making it so that when a user visits
- Test
/albums/new
- Allow users to submit your form and create an album
- Test submitting the form