Goal: Build basic Sinatra web applications with full CRUD functionality. Use RESTful naming conventions for routes.
form actionin a form determine in a Sinatra application?
app.rbroutes are used to manage data between models (classes and methods) and views (
So far our record store application isn't very useful. Once full CRUD functionality for
Albums has been added, include additional properties beside
name such as
artist and so on. Once this is complete, consider the following challenges:
Albumby name. You will need an
Album.search()method to do this. Write a test for
Album.search()before you try to implement the rest of the functionality. Hint: You may want to review this lesson for ideas on how to write a
.search()method: Mapping and the Enumerable Module. Bonus points: use a regular expression for your search implementation.
Albums by name. You will need an
sold()instance method to an
Album. This will move the
Albuminstance to a
@@sold_albumsclass variable. Implement the backend functionality first (along with testing). Once that's complete, add functionality to Sinatra to "buy" an
Albumand view both available and sold
In Greek myth, the Sphinx guarded the gates of the city Thebes. Travelers could only pass the Sphinx if they correctly answered a riddle. Build an application where a user has to answer a series of the Sphinx's riddles in order to get into the city. Woe to the user that answers incorrectly! Your application should have a "success" page (for users that correctly answer all riddles) and a "failure" page if one of the riddles is answered incorrectly. You can find examples of the Sphinx’s riddles online or you can use your own. The focus of this project is to practice routing. Do not attempt the further explorations until you have a basic application with hard-coded riddles and complete routing first.
Riddle.random()class method. This method does not need to be tested.
Lesson 24 of 37
Last updated July 28, 2022