Topic: Routing error on CPanel installation

I've installed Rails on a subdomain on a Cpanel VPS.

I have a Test Controller with an index method. Accessing this gives a routing error:

  no route found to match "/test/index" with {:method=>:get}

But I can set a direct route to the Test Controller with no problems:

  map.connect '', :controller => "test", :action => "index"
  map.connect 'welcome', :controller => 'test'

Either one of the above call the test controller with no problems.

The default routes are in my routes.rb file:

  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'

Anyone have any ideas?

(And sorry for the dupe, but this is driving me nuts).

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

The plot thickens!

I can use the console to directly call the controllers.

>> app.get "/"
=> 200
>> app.controller.params
=> {"action"=>"index", "controller"=>"home"}

>> app.get "/home"
=> 200
>> app.controller.params
=> {"action"=>"index", "controller"=>"home"}

But calling "{domain}/home" returns a routing error.

Is this then a .htaccess issue?

This is my .htaccess file:

  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ dispatch.fcgi?$1 [QSA,L]

(I must admit that I copied this from the Rails Wiki ... I am not sure what I am doing).

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

The .htaccess file has the FastCGI configured.
RewriteRule ^(.*)$ dispatch.fcgi?$1 [QSA,L]


Is FastCGI installed?

Re: Routing error on CPanel installation

Yes. FastCGI is installed. And working.

Creating an explicit or named route to a controller/method works:

  map.connect 'welcome', :controller => "test", :action => "index"

The default mappings just don't seem to be working.

I don't want to have to add mappings for each of my controllers. I left Java behind for a reason!

smile

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Does reinstalling Rails activate the default routing?

Re: Routing error on CPanel installation

I've reinstalled Rails with no luck.

I've also used a fresh test Application ... to no avail. It's very strange, I've never seen this before.

Guess I will be manually adding my routes ... rather annoying.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Run a controller test to test if the default route gets routed.
def test_index
    assert_generates("/test", :controller => "test", :action => "index")
  end

Re: Routing error on CPanel installation

OK ... that test fails:

  The generated path <"/"> did not match <"/test">

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

If I delete an explicit mapping to the controller, the test passes.

I had a mapping in routes.rb:

  map.connect '', :controller => "test"

With that commented out, the test now passes

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Ping!

I still don't have this working ... any ideas?

Last edited by tobyhede (2007-05-22 08:17:01)

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Curiouser and curiouser.

In an effort to keep forging ahead with my project, I've tried to just create manual entries in routes.

BUT .. that doesn't work properly either

I've added:

  map.connect "test", :controller => "test"
  map.connect "home", :controller => "home"

Calling the URLs:
  {domain}/test
  {domain}/home

Works fine - the index actions are called correctly.

But if I add a different action:

  {domain}/home/show

I get a routing error.

This is driving me crazy.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Still don't have this one working at all. Level 3 support has been on the case now too. All very strange.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Any success Toby?  I'm seeing this EXACT same problem on my host, and there aren't many other people over there using Rails to know if they're all seeing this routing problem.

Re: Routing error on CPanel installation

It's now working with CGI, but not FastCGI.

Not sure how this will work in production on a CGI-based system. I am going to look at using Mongrel instead, I think.

Toby Hede
===================================================
FiniteStateMachine - Software Development for Social Networks
===================================================

Re: Routing error on CPanel installation

Hmm.. unfortunately I'd have to switch hosts to try that. Mine's a LAMP oriented host with 99% of their customer developers doing PHP.  And I've already paid for a year, which I'm only 2-mnths into sad