我在这里查看了所有关于设计路由错误的讨论,但找不到解决我问题的解决方案。我的环境如下: - Ruby 1.9.3 - Rails 3.2.6 - Devise 2.2.0
我按照这里的所有步骤操作:https ://github.com/plataformatec/devise
这些文件是:
路线.rb:
Dealzhunt::Application.routes.draw do
devise_for :members
get "browse/all"
get "home/index"
root :to => 'browse#all'
# some other code
成员.rb:
class Member < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
# attr_accessible :title, :body
end
耙路线:
new_member_session GET /members/sign_in(.:format) devise/sessions#new
member_session POST /members/sign_in(.:format) devise/sessions#create
destroy_member_session DELETE /members/sign_out(.:format) devise/sessions#destroy
member_password POST /members/password(.:format) devise/passwords#create
new_member_password GET /members/password/new(.:format) devise/passwords#new
edit_member_password GET /members/password/edit(.:format) devise/passwords#edit
PUT /members/password(.:format) devise/passwords#update
cancel_member_registration GET /members/cancel(.:format) devise/registrations#cancel
member_registration POST /members(.:format) devise/registrations#create
new_member_registration GET /members/sign_up(.:format) devise/registrations#new
edit_member_registration GET /members/edit(.:format) devise/registrations#edit
PUT /members(.:format) devise/registrations#update
DELETE /members(.:format) devise/registrations#destroy
browse_all GET /browse/all(.:format) browse#all
root / browse#all
对于以下网址:
http://localhost:3000/members/sign_in
http://localhost:3000/members/sign_up
我收到以下错误:
No route matches {:controller=>"devise/browse", :action=>"all", :category=>0}
我观察到的一个奇怪症状是,如果我修改 root :to => 'home#index',消息是一样的。我认为它至少会更改为 devise/home 但它仍保留在 /browse
最奇怪的是我开始了一个新的清洁导轨项目,设计确实有效。我想知道是不是因为我运行 rails generate devise:install 时发生了一些错误
真的被这个问题困住了。有人能帮助我吗?