Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"}
like image 658
Fernando Aureliano Avatar asked Jul 06 '11 23:07

Fernando Aureliano


1 Answers

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.

like image 55
jonaphin Avatar answered Sep 30 '22 13:09

jonaphin