2013-11-09 71 views
0

我的網絡應用程序我使用設計進行用戶身份驗證。唉,應用程序 不返回登錄(或註冊)頁面,當我點擊鏈接,但 的根頁面。也許有人可以幫忙?謝謝!設計:鏈接不工作

的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> 

耙路線:

  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

更改您的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」的路徑名,但devise正在尋找您沒有路徑定義的複數資源名稱。

+0

謝謝@trh,這與瀏覽器重新啓動解決它。 – Tament