Nested Route Issue Rails 2.0

Hi guys, having an issue with a nested route mapping. Do you have any

Almost done with my app from a Rails book I'm studying, built a
'mobile' subfolder to provide support for mobile devices. Here is the

map.resources :users,
:controller => 'mobile/users',
:path_prefix => '/mobile',
:name_prefix => 'mobile_' do |users|
users.resource :entries,
:controller => 'mobile/entries',
:name_prefix =>'mobile_'

where a user has several blog entries.

The URL I'm trying to access here is


which according to 'rake routes' should give me the index method of
the mobile/entries controller. However, the above URL ends up taking
me to the UsersController instead, despite what rake routes is telling
me. The result is that I end up with the "no action responded to 1"

If you'd like to have a look at the app, I've zipped it up and placed
it in this address:

You can also go into the actual site
and go to Blogs and click on the Admin link at the top to get the same
error, or use the URL

Hi cpaesleme,
Try changing "users.resource :entries" to "users.resources :entries",
then moving the whole map.resources :users block to a line in the
routes.rb file, making sure it appears before the default config
  map.connect ':controller/:action/:id.:format'
  map.connect ':controller/:action/:id'

If you plan on supporting both mobile and 'non-mobile' browsers then
you probably want to use namespace in routes:

map.namespace :mobile do |mobile|
  mobile.resources :users

map.resources :users

This should give you a 'default' routing for 'normal' users (PCs) and
a 'mobile' alternative. You'll have to do the work of determining
which one is appropriate for any given request. The advantage of
using namespacing, though, is that it will automatically look in the /
views/mobile/users folder for the view code.

Hey guys,

Thanks for the suggestions. I implemented the namespace, which is
cleaner and leads to less code, and it generates the correct routes
and everything, but still mobile_user_entries_url is redirecting to
the users_controller instead of the entries_controller like rake
routes indicates.

I'll keep poking around the code, let me know if you think of anything
else to try!

AndyV wrote:

After poking around for another 4 hours, I finally realized that I had

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

above the mobile lines, which was causing the app not to see the
mobile routes correctly. How anticlimactic.

I moved them down to the bottom of the file and now everything works
fine. Thanks for the namespace trick and for looking at my issue

cpaesleme wrote: