small medium large xlarge

Generic-user-small
22 Jun 2010, 20:40
Malcolm Arnold (21 posts)

Pg. 38. (Text in question at the bottom) Suggestion: In “Our First Action” section, this is the first time we are modifying/creating a file. For those unfamiliar(they may not know that one has to open the editor), one has to open the editor that was previously installed and replace the contents of the file vs replacing the file. We keep the same file name but simply change the contents to: ~~~

Hello from Rails!

</code>

QUESTION:  Text says:  At this point, we can see that not only have we connected the URL to our
controller, but also that Rails is pointing the way to our next.

Is pointing the way to our next what? View? Action? Path in the MVC control?  Also, what shows us this?  A diagram or language indicating how we know this would be good.  Do we know this from something the URL indicates?  After reading further, one finds the answer on pg 41.  I recommend saying that this is explained in more detail there. Even after reading page 41(The next part of the pattern, hello, identifies an action.), one can infer that the word next refer to next action.  

RECOMMENDATION: Text on page 38 be amended to say:   At this point, we can see that not only have we connected the URL to our
controller, but also that Rails is pointing the way to our next action(how the URL does this is explained in more detail on page 41 ).  


Upon reading the text and preceding text 7-8 times before getting to page 41, what I gather is going on is this.  The URL says: http://localhost:3000/say/hello

The say portion of the URL connects to the controller, the hello portion point to the next(referred to in the text below).  This next I assume refers to our next action in the MVC path. In this case, it would be the view hello





Our First Action
At this point, we can see that not only have we connected the URL to our
controller, but also that Rails is pointing the way to our next. We haven’t told
Rails what to display. That’s where views come in. Remember when we ran the
script to create the new controller? That command added six files and a new
directory to our application. That directory contains the template files for the
controller’s views. In our case, we created a controller named say, so the views
will be in the directory app/views/say.
By default, Rails looks for templates in a file with the same name as the
action it’s handling. In our case, that means we need to replace a file called
hello.html.erb in the directory app/views/say. (Why .html.erb? We’ll explain in a
minute.) For now, let’s just put some basic HTML in there:
Download work/demo1/app/views/say/hello.html.erb

Hello from Rails!

~~~ </code> Save the file hello.html.erb, and refresh your browser window. You should see it display our friendly greeting.

You must be logged in to comment