对于我的网络应用程序我正在使用设计进行用户身份验证。唉应用程序 当我点击链接时,不会返回登录(或注册)页面,但是 根页面。也许有人可以帮忙?谢谢!
routes.rb中:
root to: 'static#home'
devise_for :users
devise_for :user, :path => '', :path_names => { :sign_in => "login", :sign_out => "logout", :sign_up => "register" }
_header.html.erb:
<header class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<%= link_to "Kung Pao", '#', id: "logo" %>
<nav>
<ul class="nav pull-right">
<li><%= link_to "Start", root_path %></li>
<li><%= link_to "Login", new_user_session_path %></li>
<li><%= link_to "Registrierung", new_user_registration_path %></li>
</ul>
</nav>
</div>
</div>
</header>
rake routes:
root / static#home
new_user_session GET /login(.:format) devise/sessions#new
user_session POST /login(.:format) devise/sessions#create
destroy_user_session DELETE /logout(.:format) devise/sessions#destroy
user_password POST /password(.:format) devise/passwords#create
new_user_password GET /password/new(.:format) devise/passwords#new
edit_user_password GET /password/edit(.:format) devise/passwords#edit
PUT /password(.:format) devise/passwords#update
cancel_user_registration GET /cancel(.:format) devise/registrations#cancel
user_registration POST / devise/registrations#create
`enter code here` new_user_registration GET /register(.:format) devise/registrations#new
edit_user_registration GET /edit(.:format) devise/registrations#edit
PUT / devise/registrations#update
DELETE / devise/registrations#destroy
答案 0 :(得分:0)
将config / routes.rb更改为:
root to: 'static#home'
devise_for :users, :path => '', :path_names => { :sign_in => "login", :sign_out => "logout", :sign_up => "register" }
resources :users
您正在为“user”设置路径名,但是设计正在查找您定义的无路径的复数资源名称。