devise_invitable路由错误 [英] devise_invitable routing error
本文介绍了devise_invitable路由错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
错误:
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。
On my Rails 3.1 project, I already use Devise.
在我的宝石文件中添加了devise_invitable宝石:
I added devise_invitable gem in my Gemfile:
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中的选项(无限邀请
Set options in Devise.rb (Unlimited invitations
config.invitation_limit =
并启动我的服务器。
当我尝试访问/ users / invitation / new
When I try to access /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' }
我如何解决这个路由问题?
How can I fix this routing issue?
推荐答案
这里找到的解决方法使用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>
to:
<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>
然后一切正常
这篇关于devise_invitable路由错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文