Topic: I'm a newbie getting Routing Error, HELP

Hi I'm new to Ruby On Rails and am working through the Four Days on Rails tutorial.  I'm up to page 6 where i should be seeing my first screen but am getting message:

Routing Error

Recognition failed for "/todo"

I don't know enough to troubleshoot at this stage. Can anyone give my some suggestions?

much thanks,

Re: I'm a newbie getting Routing Error, HELP

Did you create a controller called this?

# todo_controller.rb
class TodoController < ApplicationController

Railscasts - Free Ruby on Rails Screencasts

Re: I'm a newbie getting Routing Error, HELP

Thanks for the response ryanb.
I've mad another attempt at getting going on a different project and following is some more supporting information:

I'm running rails 1.6.1 on ruby 1.8.5, actionpack 1.12.5.  I'm using WEBrick.  I've also completely uninstalled ruby & rails several times with varying versions.  Am running Windows XP Pro.

I'm consistantly getting:
    Routing Error

    Recognition failed for "/cookbook/my_test/index"

Or for any other url except the default public/index.html.

If I add the line:   
    map.connect '', :controller => "MyTest", :action => "index"
to routes.rb then I can access the page successfully. 

As this works I believe there is something going wrong translating the url to a call to my controller.  ie a configuration problem somewhere.

The app\controllers\my_test_controller.rb file contains:
    class MyTestController < ApplicationController
        def index
            render_text "hello<br>howdie"

The log\development.log file has the entries:
    ActionController::RoutingError (Recognition failed for "/cookbook/my_test/index"):
        c:/Ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:525:in `recognition_failed'
        c:/Ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/routing.rb:515:in `recognize!'
        c:/Ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in `dispatch'
        c:/Ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in `handle_dispatch'
        c:/Ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:81:in `service'
        c:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
        c:/Ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
        c:/Ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
        c:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
        c:/Ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
        c:/Ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
        c:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
    c:/Ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
    c:/Ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
        c:/Ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
        c:/Ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:67:in `dispatch'
        c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require'
        c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
        c:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
        c:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in `require' script/server:3

    Rendering c:/Ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/templates/rescues/layout.rhtml (404 Page Not Found)

Now everything else is pretty much out of the box except for some debug code I've added to routing.rb trying to figure out how the translation from url to controller call works.

Am looking forward to any guidance I can get as to what is going on/what I can do to fix it. (Hopefully it's a 2 second response and I'm just being really stoopid)


Re: I'm a newbie getting Routing Error, HELP

stevo65 wrote:

Recognition failed for "/cookbook/my_test/index"

I'm not sure where "cookbook" is coming in here. Are you typing this in the URL? If so, it will be looking for a controller called "Cookbook" with a method called "my_test" which I'm assuming there isn't one. The URL should look like this:


Railscasts - Free Ruby on Rails Screencasts

Re: I'm a newbie getting Routing Error, HELP

thanks ryanb.  finally saw the problem with my url last night.  so i was being really stoopid after all ;-)

funny that feeling of elation when you solve the problem along with feeling like a complete prat for missing something so obvious!!!  no doubt there will be other occassions.

thanks again

Re: I'm a newbie getting Routing Error, HELP

I have also newbie problem with this tutorial: … tml?page=2

I have followed tutorial and when I go to I get "Routing Error. no route found to match "/My_Test/" with {:method=>:get}" Welcome aboard -page works fine. Any ideas whats wrong?

WEBrick looks like this in cmd:

C:\rails\cookbook>ruby script\server
./script/../config/boot.rb:29:Warning: require_gem is obsolete.  Use gem instead
=> Booting WEBrick...
=> Rails application started on
=> Ctrl-C to shutdown server; call with --help for options
[2007-01-28 00:43:54] INFO  WEBrick 1.3.1
[2007-01-28 00:43:54] INFO  ruby 1.8.5 (2006-12-25) [i386-mswin32]
[2007-01-28 00:43:54] INFO  WEBrick::HTTPServer#start: pid=2508 port=3000 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET / HTTP/1.1" 200 7552 … tml?page=2 -> / - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /javascripts/prototype.js
HTTP/1.1" 200 71260 -> /javascripts/prototype.js - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /javascripts/effects.js H
TTP/1.1" 200 38200 -> /javascripts/effects.js - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /images/rails.png HTTP/1.
1" 200 1787 -> /images/rails.png - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /favicon.ico HTTP/1.1" 20
0 0
- -> /favicon.ico - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /favicon.ico HTTP/1.1" 20
0 0
- -> /favicon.ico - - [28/Jan/2007:00:45:45 Normaaliaika] "GET /rails/info/properties HT
TP/1.1" 200 892 -> /rails/info/properties - - [28/Jan/2007:01:13:43 Normaaliaika] "GET /My_Test/ HTTP/1.1" 404 6
22 … tml?page=2 -> /My_Test/ - - [28/Jan/2007:01:16:53 Normaaliaika] "GET /My_Test/ HTTP/1.1" 404 6
22 … tml?page=2 -> /My_Test/ - - [28/Jan/2007:01:17:01 Normaaliaika] "GET /My_Test/ HTTP/1.1" 404 6
- -> /My_Test/ - - [28/Jan/2007:01:33:24 Normaaliaika] "GET /garbage/ HTTP/1.1" 404 6
22 … tml?page=2 -> /garbage/ - - [28/Jan/2007:01:40:20 Normaaliaika] "GET /my_test/ HTTP/1.1" 404 6
- -> /my_test/ - - [28/Jan/2007:01:41:39 Normaaliaika] "GET / HTTP/1.1" 304 0 … tml?page=2 -> / - - [28/Jan/2007:01:41:39 Normaaliaika] "GET /javascripts/prototype.js
HTTP/1.1" 304 0 -> /javascripts/prototype.js - - [28/Jan/2007:01:41:40 Normaaliaika] "GET /javascripts/effects.js H
TTP/1.1" 304 0 -> /javascripts/effects.js - - [28/Jan/2007:01:41:40 Normaaliaika] "GET /images/rails.png HTTP/1.
1" 304 0 -> /images/rails.png

Last edited by macos (2007-01-27 19:50:34)

Re: I'm a newbie getting Routing Error, HELP

Try it without the underscore.

Railscasts - Free Ruby on Rails Screencasts

Re: I'm a newbie getting Routing Error, HELP

Well I started to use Instant Rails and got this tutorial program working.