Note that there are some explanatory texts on larger screens.

plurals
  1. POroutes as explained in RoR tutorial 2nd Ed?
    primarykey
    data
    text
    <p>The author, Michael Hartl, says:</p> <blockquote> <p>Here the rule:</p> <pre><code>get "static_pages/home" </code></pre> <p>maps requests for the URI /static_pages/home to the home action in the StaticPages controller.</p> </blockquote> <p>How? The type of request is given, the url is given, but where is the mapping to a controller and action? My tests all pass, though.</p> <p>I also tried deleting all the actions in the StaticPagesController, which just looks like this:</p> <pre><code>class StaticPagesController &lt; ApplicationController def home end def about end def help end def contact end end </code></pre> <p>...and my tests still pass, which is puzzling. No, I deleted all my actions like this:</p> <pre><code>class StaticPagesController &lt; ApplicationController end </code></pre> <p>The 2nd edition of the book(online) is really frustrating. Specifically, the section about making changes to the Guardfile is impossible to follow. For instance, if I instruct you to edit this file:</p> <pre><code>blah blah blah dog dog dog beetle beetle beetle jump jump jump </code></pre> <p>and make these changes:</p> <pre><code>blah blah blah . . . go go go . . . jump jump jump </code></pre> <p>...would you have any idea where the line 'go go go' should be in the code? </p> <p>And the hint for exercise 3.5-1 is flat out wrong. If the author would put up a comment section at the end of every chapter, the rails community could self-edit the book. </p> <p>Tests:</p> <pre><code>require 'spec_helper' describe "StaticPages" do let(:base_title) { "Ruby on Rails Tutorial Sample App" } describe "Home page" do it "should have the h1 'Sample App'" do visit '/static_pages/home' page.should have_selector('h1', :text =&gt; 'Sample App') end it "should have the title 'Home'" do visit "/static_pages/home" page.should have_selector( 'title', :text =&gt; "#{base_title} | Home") end end describe 'Help page' do it "should have the h1 'Help'" do visit "/static_pages/help" page.should have_selector('h1', :text =&gt; 'Help') end it "should have the title 'Help'" do visit '/static_pages/help' page.should have_selector( 'title', :text =&gt; "#{base_title} | Help") end end describe 'About page' do it "should have the h1 'About'" do visit '/static_pages/about' page.should have_selector('h1', :text =&gt; 'About') end it "should have the title 'About'" do visit '/static_pages/about' page.should have_selector( 'title', :text =&gt; "#{base_title} | About") end end describe 'Contact page' do it "should have the h1 'Contact'" do visit '/static_pages/contact' page.should have_selector('h1', :text =&gt; 'Contact') end it "should have the title 'Contact'" do visit '/static_pages/contact' page.should have_selector( 'title', :text =&gt; "#{base_title} | Contact") end end end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload