Rails设计不适用于localhost上的Rails 3.2.1 [英] Rails devise not working for rails 3.2.1 on localhost

查看:63
本文介绍了Rails设计不适用于localhost上的Rails 3.2.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如本教程所述,我遵循了设计在我的本地主机上工作的每个步骤- http://www.slideshare.net/wleeper/devise-and-rails 上至第8页(共22页),而且我期望使用相同的用户登录名表单,如第8页所述,但除此之外,我还收到此错误-

I followed each and every single step for devise to work on my localhost as discussed under this tutorial - http://www.slideshare.net/wleeper/devise-and-rails upto page 8 of 22 and I was expecting the same user login form as mentioned on the page 8 but apart from this, i am getting this error-

如果我将注释保留在route.rb文件中,则

If i keep the comments as it is on routes.rb file,

#match':controller(/:action(/:id))(.: format)'

然后将此消息标记-

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

And when i uncomment this line it show this error-

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

Have very less idea about rails, as I am from PHP background, but still trying some practical tests before theory, so let me know what exactly im doing wrong.

我的路线.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

只需运行耙路命令并找到它-

Just run a rake routes command and find this -

推荐答案

您访问错误的URL ..您应该使用

You are accessing the wrong url.. you should try it with

http://application/users/login

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

you dont have the right root url like

root :to => redirect("/users/login")

这篇关于Rails设计不适用于localhost上的Rails 3.2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆