0

错误:

Started GET "/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 项目中,我已经使用了 Devise。

我在我的 Gemfile 中添加了 devise_invitable gem:

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 = 

并启动我的服务器。

当我尝试访问 /users/invitation/new

我收到路由错误

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' }

如何解决此路由问题?

4

1 回答 1

0

解决方法在这里找到了设计路由错误 {: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>

“然后一切正常”

于 2013-01-09T23:13:28.323 回答