Ruby on rails 在用户使用设备登录后出现重定向问题
在用户使用Desive for rails成功登录后,我在尝试将用户重定向到用户显示页面时遇到问题。到目前为止,我尝试了以下建议: 更改了发送给用户的设计单元,显示以下方式:Ruby on rails 在用户使用设备登录后出现重定向问题,ruby-on-rails,authentication,Ruby On Rails,Authentication,在用户使用Desive for rails成功登录后,我在尝试将用户重定向到用户显示页面时遇到问题。到目前为止,我尝试了以下建议: 更改了发送给用户的设计单元,显示以下方式: devise_for :user do root :to => "users#show" end devise_for :users do get 'users', :to => 'users#show', :as => :user_root end 更改了发送给用户的设计单元,显示以下方
devise_for :user do
root :to => "users#show"
end
devise_for :users do
get 'users', :to => 'users#show', :as => :user_root
end
更改了发送给用户的设计单元,显示以下方式:
devise_for :user do
root :to => "users#show"
end
devise_for :users do
get 'users', :to => 'users#show', :as => :user_root
end
甚至尝试使用以下方式重新路由:
match '/user' => "users#show", :as => :user_root
我还重写了注册控制器
成功登录后收到的错误消息为:
找不到没有ID的用户
我的用户控制器设置如下:
class UsersController < ApplicationController
before_filter :authenticate_user!
def show
@user = User.find(params[:id])
end
end
class UsersController
我是不是错过了什么?任何帮助都将不胜感激。谢谢 找到了答案。我需要覆盖应用程序控制器中“签名后”路径的设计代码。我是这样做的:
protected
def after_sign_in_path_for(resource)
user_path(resource)
end
结束把它弄明白了。我需要覆盖应用程序控制器中“签名后”路径的设计代码。我是在为(资源)用户在(资源)路径结束时在(资源)路径中签名后使用:protecteddef