当我推送到heroku时,我的网站应用程序就会运行,但当我运行localhost:3000时,我得到一个"routing error“"no routes match "/”。我一直在到处寻找答案,但找不到该做什么。我的routes.rb如下所示。谢谢。
Kliqq::Application.routes.draw do
get "home/index"
get "welcome/index"
resources :groups
devise_for :admins
devise_for :users
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => "home#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end我现在意识到问题出在devise上。现在运行它时,我得到了"no devise_for“方法。这是我的完整记录。
config/routes.rb:2actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:233:in instance_exec' actionpack (3.0.3) lib/action_dispatch/routing/route_set.rb:233:indraw‘config/routes.rb:1 activesupport (3.0.3) lib/active_support/dependencies.rb:235:in load' activesupport (3.0.3) lib/active_support/dependencies.rb:235:inload’activesupport (3.0.3) lib/active_support/dependencies.rb:225:in load_dependency' activesupport (3.0.3) lib/active_support/dependencies.rb:596:innew_constants_in‘activesupport (3.0.3) lib/active_support/dependencies.rb:225:in load_dependency' activesupport (3.0.3) lib/active_support/dependencies.rb:235:inload’railties (3.0rails)lib/.3/application.rb:127:in reload_routes!' railties (3.0.3) lib/rails/application.rb:127:ineach‘railties (3.0.3) lib/rails/application.rb:127:in reload_routes!' railties (3.0.3) lib/rails/application.rb:120:inroutes_reloader’activesupport (3.0.3) lib/active_support/file_update_checker.rb:32:in call' activesupport (3.0.3) lib/active_support/file_update_checker.rb:32:inexecute_if_updated‘railties (3.0.3) lib/rails/.3/finisher.rb:51:in _callback_before_5' activesupport (3.0.3) lib/active_support/callbacks.rb:419:in_run_prepare_callbacks’actionpack (3.0.3) lib/reload_routes!' railties (3.0.3) lib/rails/application.rb:127:in_execute_if_updated/middleware/callbacks.rb:45:in actionpack (3.0.3) lib/action_dispatch/middleware/callbacks.rb:44:in call' rack (1.2.1) lib/rack/sendfile.rb:107:incall‘actionpack (3.0.3) call’actionpack (3.0.3) call‘call' activesupport (3.0.3) lib/active_support/callbacks.rb:415:in_run_call_callbacks (3.0.3) lib/rails/rails/call' rack (1.2.1) lib/rack/sendfile.rb:107:in/logger.rb:13:in call' rack (1.2.1) lib/rack/runtime.rb:17:incall’activesupport (3.0.3)lib/active_support/call' rack (1.2.1) lib/rack/sendfile.rb:107:in/call' actionpack (3.0.3) lib/action_dispatch/middleware/show_exceptions.rb:46:in/call' rack (1.2.1) lib/rack/runtime.rb:17:in_cache.rb:72:in call' rack (1.2.1) lib/rack/lock.rb:11:incall‘rack (1.2.1) lib/ rack /lock.rb:11:in synchronize' rack (1.2.1) lib/rack/lock.rb:11:incall’actionpack (3.0.3) _cache.rb:72:in call' railties (3.0.3) lib/rails/application.rb:168:incall‘railties (3.0.3) lib/rails/application.rb:77:in send' railties (3.0.3) lib/rails/application.rb:77:inmethod_missing’rack (1.2.1) lib/rack/content_length.rb:13:in call' rack (1.2.1) lib/rack/handler/webrick.rb:52:in服务‘/系统/库/框架/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in库运行‘/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in start’/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:inservice' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:instart‘/start_thread' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in/start_thread' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in rails start‘/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in each' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:instart’rack (1.2.1) lib/rack/handler/webrick.rb:13:in run' rack (1.2.1) lib/rack/server.rb:213:instart‘railties (3.0.3) lib/rails/commands/server.rb:65:在start' railties (3.0.3) lib/rails/commands.rb:30 railties (3.0.3) lib/rails/commands.rb:27:intap‘railties (3.0.3) lib/rails/commands.rb:27脚本/rails:6:在’`require‘脚本/rails:6
enter code here发布于 2011-01-27 08:01:15
您在Gemfile中指定Devise了吗?如果没有,就会导致"undefined method devise_for“错误。
https://stackoverflow.com/questions/4809449
复制相似问题