Devise Invitable:未初始化常量
我正在使用 devise,效果很好,现在我尝试使用 devise_invitable。 我安装正确,但是当我尝试访问
http://localhost:3000/users/invitation/new
时出现错误错误是:
于 2011-07-06 20:47:07 -0300 开始对 127.0.0.1 获取“/users/invitation/new” ActionController::RoutingError(未初始化常量用户):
在救援/布局内渲染 /Users/Fernando/.rvm/gems/ruby-1.9.2-head/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb (1.9ms)
在救援/布局 看起来不错,但我不知道为什么它会返回此错误。
路线:
accept_user_invitation
GET /users/invitation/accept(.:format)
{:action=>"edit", :controller=>"devise/invitations"}
user_invitation
POST /users/invitation(.:format)
{:action=>"create", :controller=>"devise/invitations"}
new_user_invitation
GET /users/invitation/new(.:format)
{:action=>"new", :controller=>"devise/invitations"}
I'm using devise, which works fine, now I try to use devise_invitable.
I installed it correctly, but I'm getting the error when I try to access
http://localhost:3000/users/invitation/new
The error is:
Started GET "/users/invitation/new" for 127.0.0.1 at 2011-07-06 20:47:07 -0300
ActionController::RoutingError (uninitialized constant Users):
Rendered /Users/Fernando/.rvm/gems/ruby-1.9.2-head/gems/actionpack-3.0.7/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.9ms)
The routes looks like ok, and I don't know why it return this error.
Routes:
accept_user_invitation
GET /users/invitation/accept(.:format)
{:action=>"edit", :controller=>"devise/invitations"}
user_invitation
POST /users/invitation(.:format)
{:action=>"create", :controller=>"devise/invitations"}
new_user_invitation
GET /users/invitation/new(.:format)
{:action=>"new", :controller=>"devise/invitations"}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,您必须将邀请控制器粘贴到
app/controllers
下的users
目录中才能正常工作。所以你最终会得到:
这样做将消除
统一常量
错误。Actually, you must stick your invitations controller within a
users
directory underapp/controllers
for this to work.So you would end up with:
Doing this will get rid of that
unitialized constant
error.尝试更改
为
Try changing
to