How Rails reads your URL to interpret controller verbs

In Agile, the authors explain that when a user navigates to localhost:3000/say/hello, rails matches the route pattern.  It is Restful, I think.  Rails reads say as a controller and hello as one of the actions listed in the controller.

It creates a new instance of the Ruby class SayController

It creates a new object holding the current time and puts it into the instance variable @time.

It looks for a template (i.e. a view… view = template and template = view) to display the variable

Rails Parlance

In Rails one calls methods that help make the view/template easierhelpers“.

In Rails one calls methods in the Controller handling RESTful requestsactions.“

In Rails one calls RESTful POST requests „create“ actions in the controller.

 

The Controller Asks the Model for Information, for Data.  The Controller tells the Model what to do (find information (GET), add it to the shopping cart (POST).  The Model knows how to do these data requests.  

| Back

Footerfull