2013-01-08 111 views
0

出現錯誤:devise_invitable路由錯誤

Started GET "https://stackoverflow.com/users/invitation/new" for 127.0.0.1 at 2013-01-09 01:00:31 +0100 
    Processing by Devise::InvitationsController#new as HTML 
    User Load (451.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = 3 LIMIT 1 
Rendered users/invitations/new.html.erb within layouts/application (69.2ms) 
Rendered layouts/_google_analytics.html.erb (0.4ms) 
Rendered layouts/_navbar.html.erb (73.6ms) 
Completed 500 Internal Server Error in 10785ms 

ActionView::Template::Error (No route matches {:controller=>"devise/dashboards", :action=>"show"}): 
    23:   </ul> 
    24:   <ul class="nav pull-right" id="main-menu-right"> 
    25:    <% if user_signed_in? %> 
    26:     <li><%= link_to raw("My Agenda"), {:controller => :dashboards, :action => :show}, :tabindex => "-1" %></li> 
    27:     <li><%= link_to raw("My Services"), {:controller => :creative_services, :action => :index_my_services}, :tabindex => "-1" %></li> 
    28:     <li id="fat-menu" class="dropdown"> 
    29:     <a href="#" id="dropUser" role="button" class="dropdown-toggle" data-toggle="dropdown"> 
    app/views/layouts/_navbar.html.erb:26:in `_app_views_layouts__navbar_html_erb__952134567516339951_70121556350080' 
    app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb___2663940439779075013_70121556359600' 

在我的Rails 3.1的項目,我已經使用了設計。

我在Gemfile中添加devise_invitable寶石:

gem "devise", "~> 2.0.0" 
gem 'devise_invitable', '~> 1.0.0' 

運行這些命令

rails generate devise_invitable:install 
rails generate devise_invitable User 
rake db:migrate 
rails generate devise_invitable:views users 

設置選項Devise.rb(無限邀請

config.invitation_limit = 

,並開始我的服務器。

當我嘗試訪問/用戶/邀請/新

我得到一個路由錯誤

Routing Error 

No route matches {:controller=>"devise/dashboards", :action=>"show"} 

在我的用戶模型:

devise :invitable, :database_authenticatable, :registerable, :confirmable, 
    :recoverable, :rememberable, :trackable, :validatable, :invitable 

我的路線文件:

devise_for :users, :controllers => { :registrations => 'registrations' } 

我該如何解決這個路由問題?

+0

類似的問題在這裏的http://計算器.COM /問題/ 8474537 /路由錯誤與 - 色器件控制器,色器件,靜態動作有關 – zabumba

回答

0

解決辦法在這裏找到Routing error with devise {:controller=>"devise/static", :action=>"about"}

改變了我的鏈接:

26: <li><%= link_to raw("My Agenda"), {:controller => :dashboards, :action => :show}, :tabindex => "-1" %></li> 
27: <li><%= link_to raw("My Services"), {:controller => :creative_services, :action => :index_my_services}, :tabindex => "-1" %></li> 

到:

<li><%= link_to raw("My Agenda"), "/dashboards/show", :tabindex => "-1" %></li> 
<li><%= link_to raw("My Services"), "/creative_services/index_my_services", :tabindex => "-1" %></li> 

「然後所有工作得很好」