错误:
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' }
如何修复此路由问题?
答案 0 :(得分: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>
“然后一切正常”