Note that there are some explanatory texts on larger screens.

plurals
  1. PORuby On Rails 4 - Issue with Routes
    primarykey
    data
    text
    <p>I am new to RoR and have been working on setting up my environment for the last few days (running Mountain Lion). I've finally gotten to the point where I can develop and decided to start a Trial on lynda.com when I saw <a href="http://www.lynda.com/Ruby-on-Rails-3-tutorials/essential-training/55960-2.html?srchtrk=index:0%0Alinktypeid:2%0Aq%3aruby%20on%20rails%0Apage:1%0As%3arelevance%0Asa%3atrue%0Aproducttypeid:2" rel="nofollow">this lesson</a>.</p> <p>It's been great so far for learning the principles &amp; theories of Rails, but it was made in 2010 and I've found out the hard way how much changes between major releases of Rails. For example, a <em>generated</em> project no longer contains a scripts folder - these are just called using the <em>rails</em> command in Mac's command line.</p> <p>In the last lesson, the instructor generated a new rails project, added a controller:</p> <pre><code>class SayController &lt; ApplicationController def hello end end </code></pre> <p>and added a view (views -> say -> ['hello.rhtml'])</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Hello World&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;p&gt;Hello World&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>That was it. Next he just started up the rails server, jumped over to firefox, and entered the address <code>[http://localhost:3000/say/hello]</code>. The browser displayed the text "Hello World" as you would expect. </p> <p>I, however, get "No route matches [GET] '/say/hello' ". I know this is a problem with routes, I just can't find a good (&amp; RoR 4 specific) explanation of usage. </p> <p>The line that seems to enable everything to work by default in the instructors project is:</p> <pre><code>map.connect ':controller/:action/:id' </code></pre> <p>I tried adding this (my routes.rb was generated with everything commented out), but it didn't work and I assume the RoR 4 convention is different. </p> <p>So is there a default route for RoR 4? Does v4 not allow actions that return null or has the syntax changed? </p> <p>The error page says my current route is <code>Rails.root: /Users/abcde/Sites/RoR/my_app/</code> which is where I have the rails server running, so I'm not sure if that matters. </p> <p>The route trace &amp; log just restate that my route (/say/hello/) doesn't exist), but I can post them if needed.</p>
    singulars
    1. This table or related slice is empty.
    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