开发者

Routing error on Heroku (after logging in via Devise)

开发者 https://www.devze.com 2023-03-04 03:07 出处:网络
For my rails 3 app I have a route setup as follows namespace :user do root :to => \"reading_schedules#index\"

For my rails 3 app I have a route setup as follows

namespace :user do
  root :to => "reading_schedules#index"
end

This is what my "rake routes" shows

user_root /user(.:format) {:controller=>"user/reading_schedules", :action=> "index }

Everything works fine on my localmachine. But as soon as I push the site up to Heroku and login I get the following error in my logs

ActionController::RoutingError (uninitialized constant User::ReadingSchedulesController):

If I navigate to the root of the site everything else works开发者_StackOverflow中文版 fine. But this one url doesn't work. The url it's trying to hit is website/user but like I said, it works fine on my localmachine.

EDIT: Here's the rest of my routes file

devise_for :users, :path => 'accounts'

root :to => "home#landing"

namespace :user do
  root :to => "reading_schedules#index"
end

resources :users do
  resources :reading_schedules
  member do
    get :change_password
    post :change_password
  end
end

resources :reading_schedules do
  member do
    get :recalculate
  end
end


I found this question first in looking for an answer to the same issue. For any future searchers, check out this link.

For me, it was a combination of the last two answers in this post (adapted for my controllers of course.)

Also of note, this corrected the issue without having to reset the database.

ActionController::RoutingError (uninitialized constant User::UsersController) in heroku (but everything works in local)


Probably not the answer you are looking for but

heroku rake db:reset

solved the problem for me. I didn't have any critical data in the db so it was not a problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消