CRUD With Validations Lab
Your goal in this lab is to create a thorough CRUD interface for one model, the Song.
Songs
Songs have the following attributes and limitations:
title, astringMust not be blank
Cannot be repeated by the same artist in the same year
released, abooleandescribing whether the song was ever officially released.Must be
trueorfalse
release_year, anintegerOptional if
releasedisfalseMust not be blank if
releasedistrueMust be less than or equal to the current year
artist_name, astringMust not be blank
genre, astring
Requirements
Use the resource generator, not the scaffold generator
Define a model with validations for
SongDefine all RESTful routes for songs
Render the list of songs in an HTML table.
Build views that connect to each other using route helpers.
Use
form_forto build forms with pre-fill and error list features. (Hint: Try using a partial to cut down on copy/pasting!)Allow deleting songs with a link, using
link_to. Check out the official documentation for additional info including setting themethod:to:delete.Use strong parameters in your POST/PATCH controller actions.
Set the root route to the song index.
Clone here: https://github.com/learn-co-curriculum/crud-with-validations-lab
Last updated