Forum: Ruby on Rails understanding routes.rb

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
F8d196408f5a602e0fed6096d41ed5f9?d=identicon&s=25 (Guest)
on 2007-04-04 08:07
(Received via mailing list)

I am very new to ruby and rails...but I am trying to get the
LoginGenerator up and running as quick test, but I have run into the
following problem:

Routing Error

no route found to match "/p/arash2/myapp/" with {:method=>:get}

so i figured that i need to change the routes.rb file, and I changed
it to this:

 map.connect 'p/myapp/users', :controller => 'users',

and I end up with this error

Unknown action

No action responded to index

I am pretty sure I am missing something big here, and it would be
obvious if I knew rails a bit more, but I am trying to run a
feasibility test, so im more concerned with getting things working
first, and understanding them second.

5030981121b21bed8aee074f68bd5074?d=identicon&s=25 Russell Norris (Guest)
on 2007-04-04 16:01
(Received via mailing list)
I'm not sure I understand why your routes look the way they do. Are you
running Rails from some kind of subdirectory setup? There's some added
difficulties with doing that. If it's at all possible, you should run
Rails app from the root level of a domain. It can be in any physical
directory on the server but it really [AFAIK] helps to be in the root of

Also, if you could paste more [or all!] of your routes.rb in your next
it would help more as well. :)

F8d196408f5a602e0fed6096d41ed5f9?d=identicon&s=25 (Guest)
on 2007-04-04 18:34
(Received via mailing list)
Hi Russell,

thanks for your reply. The reason I am not running from the root of my
domain is because there is already a cgi application (running through
Apache). I really don't want to screw things up there, so I figured I
would just create my application from a sub directory, and run it from
there. Also, I couldn't get Apache to work with rails (albeit I didn't
try very hard, so I just run WEBrick, using port 3000, which is fine
for my feasibility tests).

So anyways, I start WEBrick, and in my browser, I go to: (as the LoginGenerator example
directed), but I was getting the following Routing Error:

Routing Error

no route found to match "/p/myapp/" with {:method=>:get}

So I figured the problem was with my routes.rb, but I really don't
understand whats goin on in this file. Also, as you requested, here is
my entire routes.rb (I only added one line, and I have pointed it out)

ActionController::Routing::Routes.draw do |map|
  # The priority is based upon order of creation: first created ->
highest priority.

  # Sample of regular route:
  # map.connect 'products/:id', :controller => 'catalog', :action =>
  # Keep in mind you can assign values other than :controller
and :action

  # Sample of named route:
  # map.purchase 'products/:id/purchase', :controller =>
'catalog', :action => 'purchase'
  # This route can be invoked with purchase_url(:id =>

  # You can have the root of your site routed by hooking up ''
  # -- just remember to delete public/index.html.
   map.connect 'p/myapp/users', :controller => 'users', :action =>
'start'                  <-----I added this line

  # Allow downloading Web Service WSDL as a file with an extension
  # instead of a file named 'wsdl'

  #map.connect ':controller/service.wsdl', :action =>
'wsdl'            <------I commented this line out (was originally

  # Install the default route as the lowest priority.
':controller/:action/:id.:format'                              <------
I commented this line out (was originally uncommented)
<------I commented this line out (was originally uncommented)

Thanks again for your help!
This topic is locked and can not be replied to.