https://rps-rcav-your-username.c9users.io/scissors, there are a lot of dots to connect!
get()method, which has two arguments. The first argument is a
Stringthat contains the address we want to support; in this case,
Hashthat tells Rails what to do when someone visits the address. The
Hashhas two keys:
:controllermust go to the name of a Ruby class; in this case, we chose
:actionmust go to the name of a Ruby method that we want Rails to execute when a user visits
/scissors; in this case, we chose
app/controllersfolder. Files that contain controllers must always end in
_controller.rb, and begin with what we said in the route would be the name of the controller; in this case,
CamelCasedand always end in
...Controller < ApplicationController. In this case,
GameController < ApplicationController.
render()method. The complete
render()method looks like this:
render()takes one argument, a
String. The string specifies the location of an Embedded Ruby HTML template to use to format the output. The first part of the string specifies the name of a folder, in this case
@when you create them. E.g. I define
@comp_move = ["rock", "paper", "scissors"].samplerather than
comp_move, and then
@comp_moveis available in the view template (rather than dying when we reach the
endof the method, like a local variable would).
app/viewsthat matches the name that we specified in the
.html.erbtemplate, produce a final plain
.htmlfile, and send it back to the user's browser. Hurray!
snake_case; only class names are
app/controllers/(be careful not to put the controller in