我是rails的新手,我很难找到使用设计的轨道3中的路由
当我溃倒到用户页面时,我收到了这个丑陋的错误:http://s9.postimage.org/nlyxhlk5b/Devise_routing.png
在我的路线中我有
#Resources for users
devise_for :users, :controllers => { :registrations => "registrations" }
resource :users do
get 'welcome'
end
这些是我的用户路线
已更新
root / members#welcome
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
我可能没有2个用户资源吗?我相信他们可能会以某种方式发生冲突,或者我只是错过了一些东西?
更新
我忘了提到我正在覆盖默认的设计注册控制器
class RegistrationsController < Devise::RegistrationsController
protected
# Redirect to welcome page after a successful registration
def after_sign_up_path_for(resource)
'/users/welcome'
end
end
答案 0 :(得分:1)
删除用户控制器 删除注册控制器
除去
resource :users do
get 'welcome'
end
将此添加到您的路线
# Directing the user after login
authenticated :user do
root :to => 'recipes#index'
端
更改
devise_for :users, :controllers => { :registrations => "registrations" }
要
devise_for :users
让我知道这是怎么回事