Hi:
I’m in the midst of upgrading a Rails 2.3 app to 3.0. The app boots and many pages display fine. However, tests fail and the app fails in development for nested routes such as http://localhost:3000/users/hikari17/projects.
The error is “uninitialized constant ProjectsController”. This looks like the router is trying to point the app to the ProjectsController (in /controllers) rather than Users::ProjectsController (in /controllers/users).
/controllers/projects_controller.rb doesn’t exist. Only the nested version /controllers/users/projects_controller/rb exists. Why would the http://localhost:3000/users/hikari17/projects url be routed to the non-nested controller?
The problem must lie my routes.rb file, right? I converted it from the rails2 version following the guidelines in #203 Routing in Rails 3 - RailsCasts and in the Rails upgrade handbook, but I seem to have messed something up. Here’s the relevant portion of the routes.rb file:
ROUTES_PROTOCOL = (ENV["RAILS_ENV"] =~ /(development|test)/ ? "http" : "https")
Genlighten::Application.routes.draw do
# users resources :users do
member do
get :welcome
get :feedback
get :dashboard
get :not_found
end
collection do
get :autocomplete_for_user_login
post :is_login_available
post :is_email_available
end
[many lines omitted]
# projects -- from client point of view
resources :projects do
collection do
get :pending
get :in_process
get :completed
get :archived
end
end
end
Thanks very much!
–Dean Richardson