Required Demos-n-Deets demos:
Optional demos (for now): Everything else in the “Forms and Actions for Managing Model Objects” section of the Demos-n-Deets.
Follow the general instructions for active reading for the above required demos.
What to submit:
valid?
showing.destroy
method visible,button_to
call associated with the destroy
action showing, andImportant! All screenshots must include your computer’s desktop in the background so that it is recognizable as your desktop. Also, all screenshots of web pages must display the entire URL of the page in the browser’s location bar. (Watch out, as some browsers like to hide parts of the URL unless you click on it.)
Before proceeding, be sure to read the general description and instructions for the practice tests.
Start with the base project on the playlist-maker
branch of this repo: https://github.com/memphis-cs/practice-apps-2023-08fall
The aim of this project is enable users to make a playlist of songs (also called tracks). The project already includes a Track
model class, as per this class diagram:
Note that the length
attribute is measured in seconds.
In addition to this model class, the project also already includes the following:
Track
classTracksController
classIf you initialize and run the app, you will see that the index page looks like this:
And the show pages look like this:
Task to perform:
Track
objects.
number_field
form helper (e.g., instead of text_field
) for the order_number
and length
attributes of Track
.Track
objects.Track
objects.Make these features work in a manner consistent with how they worked in the above demos.
What to submit:
Screenshots of the following code files:
Screenshot of the browser displaying the following pages:
Important! All screenshots must include your computer’s desktop in the background so that it is recognizable as your desktop. Also, all screenshots of web pages must display the entire URL of the page in the browser’s location bar. (Watch out, as some browsers like to hide parts of the URL unless you click on it.)
Before proceeding, be sure to read the general instructions for the explanation videos.
Start with the base project on the video-game-db
branch of this repo: https://github.com/memphis-cs/practice-apps-2023-08fall
The aim of this project is enable users to make a database of video games. The project already includes a VideoGame
model class, as per this class diagram:
In addition to this model class, the project also already includes the following:
VideoGame
classVideoGamesController
classIf you initialize and run the app, you will see that the index page looks like this:
The video can begin after you have cloned, initialized, and run the base app.
Task to perform:
VideoGame
objects.VideoGame
objects.Make these features work in a manner consistent with how they worked in the above demos.
Watch out! To implement the destroy links, you will need to write code to index.html.erb
similar to the following, where v
is a variable that references the current VideoGame
object:
<%= button_to 'delete', video_game_path(v), method: :delete, data: { turbo: false } %>
However, there is a problem with the path helper method, video_game_path(v)
. This path helper method is typically specified by the as:
argument in a show route (specifically, as: 'video_game'
), but this app doesn’t have a show route. Thus, this helper method doesn’t exist (yet).
When situations like this arise, you can add the as:
argument to a different route in order to get the desired path helper. The only piece of information that the path/URL helpers use from a route is the resource path part. Thus, if you have two routes with the same resource path, there’s no point in specifying multiple as:
arguments.
The show, update, and destroy routes all typically have the same resource path, so it’s common to specify the as:
argument only for the show route; however, if you don’t have a show route, then you can add the as:
argument to one of the others.
In this case, you will probably want to add the as:
argument to the delete
route.