I'm using devise, wich 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 dont 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"}
jonaphin
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' }
来源:https://stackoverflow.com/questions/6604383/devise-invitable-uninitialized-constant