title: devise overriding registrations controller - uninitialized constant Users::RegistrationsController
body: <p>I'm trying to override some the functionality of the default devise registrations controller so that only certain users can create accounts for others. So in a file called registrations_controller.rb under the controllers/users folder I have the following</p>
  
  <pre><code>class Users::RegistrationsController &lt; Devise::RegistrationsController
  
    before_filter :check_permissions, :only =&gt; [:new, :create, :cancel]
    skip_before_filter :require_no_authentication
  
    def check_permissions
      authorize! :create, resource
    end
  end
  </code></pre>
  
  <p>and in my routes file I have </p>
  
  <p>devise_for :users, :controllers => { :registrations => 'users/registrations' }</p>
  
  <p>When I try to go to the users/sign_up url I get a a routing error 'uninitialized constant Users::RegistrationsController'. </p>
  
  <p>So what is really weirding me out about this is that I had used pretty much exactly the same functionality in a rails 3 app without a problem. I had a look at some of the other stackoveflow questions similar to this and I'm still none the wiser. The app I'm building now is a rails 3.1 app and I'm using devise 1.5.1</p>
  
  <p>Here are the relevant routes it case they useful </p>
  
  <pre><code>new_user_session GET    /users/sign_in(.:format)                                      {:action=&gt;"new", :controller=&gt;"devise/sessions"}
                           user_session POST   /users/sign_in(.:format)                                    {:action=&gt;"create", :controller=&gt;"devise/sessions"}
                   destroy_user_session DELETE /users/sign_out(.:format)                                   {:action=&gt;"destroy", :controller=&gt;"devise/sessions"}
                          user_password POST   /users/password(.:format)                                   {:action=&gt;"create", :controller=&gt;"devise/passwords"}
                      new_user_password GET    /users/password/new(.:format)                               {:action=&gt;"new", :controller=&gt;"devise/passwords"}
                     edit_user_password GET    /users/password/edit(.:format)                              {:action=&gt;"edit", :controller=&gt;"devise/passwords"}
                                        PUT    /users/password(.:format)                                   {:action=&gt;"update", :controller=&gt;"devise/passwords"}
               cancel_user_registration GET    /users/cancel(.:format)                                     {:action=&gt;"cancel", :controller=&gt;"users/registrations"}
                      user_registration POST   /users(.:format)                                            {:action=&gt;"create", :controller=&gt;"users/registrations"}
                  new_user_registration GET    /users/sign_up(.:format)                                    {:action=&gt;"new", :controller=&gt;"users/registrations"}
                 edit_user_registration GET    /users/edit(.:format)                                       {:action=&gt;"edit", :controller=&gt;"users/registrations"}
                                        PUT    /users(.:format)                                            {:action=&gt;"update", :controller=&gt;"users/registrations"}
                                        DELETE /users(.:format)                                            {:action=&gt;"destroy", :controller=&gt;"users/registrations"}
  </code></pre>