Devise Invitable: uninitialized constant
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"}
Actually, you must stick your invitations controller within a users
directory under app/controllers
for this to work.
So you would end up with:
/app/controllers/users/invitations_controller.rb
Doing this will get rid of that unitialized constant
error.
Try changing
devise_for :users, controllers: { invitations: 'users/invitations' }
to
devise_for :users, controllers: { invitations: 'devise/invitations' }
精彩评论