Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 设计URL Rails的别名_Ruby On Rails_Devise - Fatal编程技术网

Ruby on rails 设计URL Rails的别名

Ruby on rails 设计URL Rails的别名,ruby-on-rails,devise,Ruby On Rails,Devise,我是RubyonRails新手,我正在使用DesiveGem对表帐户用户进行身份验证。 当我执行rake路由时 new_account_user_session GET /account_users/sign_in(.:format)account_user/sessions#new 所以我的登录页面是xyz.com/account\u users/sign\u in。 我想将登录页面更改为justxyz.com 在我的routes.rb文件中没有任何相同的路由,我认为Desive会自动为此生

我是RubyonRails新手,我正在使用DesiveGem对表帐户用户进行身份验证。 当我执行
rake路由时

new_account_user_session GET /account_users/sign_in(.:format)account_user/sessions#new
所以我的登录页面是
xyz.com/account\u users/sign\u in
。 我想将登录页面更改为just
xyz.com

在我的routes.rb文件中没有任何相同的路由,我认为Desive会自动为此生成路由


是否有一种方法可以为这个设计生成的路由添加别名/覆盖,或者将用户重定向到
xyz.com
,而不是
xyz.com/account\u users/sign\u in

设置root以设计登录,因此在路由文件中应该有

devise_for :account_users
devise_scope :account_user do
  root to: 'devise/sessions#new'
end
这将设置要登录的根路径

或者,如果要将路由重命名为“登录”

devise_for :account_users
devise_scope :account_user do
  get 'login', to: 'devise/sessions#new'
end
更多