ActionController::RoutingError (uninitialized constant User::UsersController) in heroku (but everything works in local)
I am trying to run my app in heroku but I get this error when trying to signup or even access devise's login page:
ActionController::RoutingError (uninitialized constant User::UsersController)
Is this a devise bug or a server setting i missed in heroku?
I am running a rails3.1 app in a c开发者_StackOverflow社区edar stack by the way and loading the index page is good, but if I try to login or sign up, it blows.
The signup form DOES show, but when I submit, that's when it blows. I checked the logs and it did POST to the controller but GETting the resulting page(when redirected I guess) blows it up.
Any help?
EDIT
here are my routes:
root :to => "home#index"
devise_for :users
namespace :user do
root :to => "users#welcome"
end
resources :users, :only => :show
A heroku support person also asked about my routes but why does it happen in production only? Also I don't think there's any problem with the routes...is there?
I found the you do not need to remove the default root for when a user logs in. So replace the namespace
call and use the following:
match 'users' => 'users#welcome', :as => 'user_root'
This way you can still have two "home" pages. It worked for me.
https://github.com/plataformatec/devise/wiki/How-To%3a-Redirect-to-a-specific-page-on-successful-sign-in
This is your problem:
namespace :user do
root :to => "users#welcome"
end
Can you remove this?
I got the same error. Error was only reproducible in Heroku, not locally. What I realized is that while I had added the resource to routes and pushed that, all the generated scaffold was still lying locally. Once I added all the generated stuff to git and pushed, worked fine on Heroku.
精彩评论