0

我按照本教程中讨论的设计在我的本地主机上工作的每一步 - http://www.slideshare.net/wleeper/devise-and-rails upto page 8 of 22并且我期待与上面提到的相同的用户登录表单第 8 页,但除此之外,我收到此错误 -

如果我保留在 routes.rb 文件中的评论,

# 匹配 ':controller(/:action(/:id))(.:format)'

然后这个消息标志 -

错误 1

当我取消注释此行时,它会显示此错误-

错误 2

因为我来自 PHP 背景,所以对 Rails 的了解很少,但在理论之前仍然尝试一些实际测试,所以让我知道我到底做错了什么。

我的 routes.rb 文件 -

Prjmgt::Application.routes.draw do
  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 => 'welcome#index'
    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

只需运行一个rake routes命令并找到这个 -

耙路线

4

1 回答 1

1

您正在访问错误的网址..您应该尝试使用

http://application/users/login

您没有正确的根网址,例如

root :to => redirect("/users/login")
于 2013-01-20T19:00:23.557 回答