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,
steve

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

Did you create a controller called this?

# todo_controller.rb
class TodoController < ApplicationController
  #...
end

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"
        end
    end

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/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick.rb:59
        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/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30
        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)

Regards,
stevo

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:

http://localhost:3000/my_test/index

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
stevo

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

I have also newbie problem with this tutorial: http://www.onlamp.com/pub/a/onlamp/2005 … tml?page=2

I have followed tutorial and when I go to http://127.0.0.1:3000/My_Test/ I get "Routing Error. no route found to match "/My_Test/" with {:method=>:get}"
http://127.0.0.1:3000/ 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 http://0.0.0.0:3000
=> 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
127.0.0.1 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET / HTTP/1.1" 200 7552
http://www.onlamp.com/pub/a/onlamp/2005 … tml?page=2 -> /
127.0.0.1 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /javascripts/prototype.js
HTTP/1.1" 200 71260
http://127.0.0.1:3000/ -> /javascripts/prototype.js
127.0.0.1 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /javascripts/effects.js H
TTP/1.1" 200 38200
http://127.0.0.1:3000/ -> /javascripts/effects.js
127.0.0.1 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /images/rails.png HTTP/1.
1" 200 1787
http://127.0.0.1:3000/ -> /images/rails.png
127.0.0.1 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /favicon.ico HTTP/1.1" 20
0 0
- -> /favicon.ico
127.0.0.1 - - [28/Jan/2007:00:44:54 Normaaliaika] "GET /favicon.ico HTTP/1.1" 20
0 0
- -> /favicon.ico
127.0.0.1 - - [28/Jan/2007:00:45:45 Normaaliaika] "GET /rails/info/properties HT
TP/1.1" 200 892
http://127.0.0.1:3000/ -> /rails/info/properties
127.0.0.1 - - [28/Jan/2007:01:13:43 Normaaliaika] "GET /My_Test/ HTTP/1.1" 404 6
22
http://www.onlamp.com/pub/a/onlamp/2005 … tml?page=2 -> /My_Test/
127.0.0.1 - - [28/Jan/2007:01:16:53 Normaaliaika] "GET /My_Test/ HTTP/1.1" 404 6
22
http://www.onlamp.com/pub/a/onlamp/2005 … tml?page=2 -> /My_Test/
127.0.0.1 - - [28/Jan/2007:01:17:01 Normaaliaika] "GET /My_Test/ HTTP/1.1" 404 6
22
- -> /My_Test/
127.0.0.1 - - [28/Jan/2007:01:33:24 Normaaliaika] "GET /garbage/ HTTP/1.1" 404 6
22
http://www.onlamp.com/pub/a/onlamp/2005 … tml?page=2 -> /garbage/
127.0.0.1 - - [28/Jan/2007:01:40:20 Normaaliaika] "GET /my_test/ HTTP/1.1" 404 6
22
- -> /my_test/
127.0.0.1 - - [28/Jan/2007:01:41:39 Normaaliaika] "GET / HTTP/1.1" 304 0
http://www.onlamp.com/pub/a/onlamp/2005 … tml?page=2 -> /
127.0.0.1 - - [28/Jan/2007:01:41:39 Normaaliaika] "GET /javascripts/prototype.js
HTTP/1.1" 304 0
http://127.0.0.1:3000/ -> /javascripts/prototype.js
127.0.0.1 - - [28/Jan/2007:01:41:40 Normaaliaika] "GET /javascripts/effects.js H
TTP/1.1" 304 0
http://127.0.0.1:3000/ -> /javascripts/effects.js
127.0.0.1 - - [28/Jan/2007:01:41:40 Normaaliaika] "GET /images/rails.png HTTP/1.
1" 304 0
http://127.0.0.1:3000/ -> /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.

http://127.0.0.1:3000/mytest/

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.