In this project, we'll learn about forms, which are arguably the most important components of an interactive web application.
Start by attempting this quick puzzle. What do you think?
We're going to build a simple clone of that site.
Here is our target, but your version will differ slightly -- it won't save past guesses. It will only show the single most recent guess.
- Fork this repository.
- Clone your fork.
- Open the entire folder you downloaded in Atom.
- Commit and sync often.
- Run
rails grade
when you are ready to see how you are doing.
- Create two RCAVs (use the RCAV Flowchart), one for
/all_guesses
and one for/show_answer
. You can copy the content frompublic/answer_mockup.html
andpublic/guesses_mockup.html
. - Start at the end and make the Answer form work to send the user from
/all_guesses
to/show_answer
and parrot back the answer they submitted. - Make the Guesses form work to send the user from
/all_guesses
back to/all_guesses
and parrot back the guess they submitted. - Add some logic to report whether the guess obeyed the rule or not.
What would we need in order to store the history of all past guesses the way that the target does? The ability to write information to disk permanently, which will be our next focus. If you'd like a sneak peek, have a look at the next cheatsheet -- CRUD with Ruby. Can you figure out how to add the history of guesses to this project?