title: Rails RoutingError (uninitialized constant
body: <p>I'm trying to create a simple registration model that will respond only to json:</p>
  
  <pre><code>class Api::RegistrationController &lt; ApplicationController
    skip_before_filter  :verify_authenticity_token
    respond_to :json
    def register
      build_resource(sign_up_params)
      if resource.save
        render :status =&gt; "OK"
      else
        render :status =&gt; "ERROR"
      end
    end
  end
  </code></pre>
  
  <p>When trying to register I get:</p>
  
  <pre><code>Started POST "/api/register" for 10.0.0.4 at 2013-07-22 07:45:44 +0300
  Processing by Api::RegistrationController#register as JSON
    Parameters: {"user"=&gt;{"password_confirmation"=&gt;"[FILTERED]", "password"=&gt;"[FILTERED]", "email"=&gt;"mmm@mmm.mmm"}, "registration"=&gt;{"user"=&gt;{"password_confirmation"=&gt;"[FILTERED]", "password"=&gt;"[FILTERED]", "email"=&gt;"mmm@mmm.mmm"}}}
  Completed 500 Internal Server Error in 1ms
  
  NameError (undefined local variable or method `sign_up_params' for #&lt;Api::RegistrationController:0x4eca9e0&gt;):
    app/controllers/api/registration_controller.rb:5:in `register'
  </code></pre>
  
  <p>This is obvious because I'm trying to use <strong>sign_up_params</strong> that belong do Devise.</p>
  
  <p>So next I try to inherit:</p>
  
  <pre><code>class Api::RegistrationController &lt; Devise::RegistrationController
  </code></pre>
  
  <p>Restart server and getting this error:</p>
  
  <pre><code>Started POST "/api/register" for 10.0.0.4 at 2013-07-22 07:50:03 +0300
  
  ActionController::RoutingError (uninitialized constant Devise::RegistrationController):
    app/controllers/api/registration_controller.rb:1:in `&lt;top (required)&gt;'
  </code></pre>
  
  <p>This is my routes:</p>
  
  <pre><code>Notter12::Application.routes.draw do
    post "api/register" =&gt; "api/registration#register"
  
    devise_for :users
  .
  .
  .
  </code></pre>
  
  <p>Rake:</p>
  
  <pre><code>            api_register POST   /api/register(.:format)        api/registration#register
          new_user_session GET    /users/sign_in(.:format)       devise/sessions#new
              user_session POST   /users/sign_in(.:format)       devise/sessions#create
      destroy_user_session DELETE /users/sign_out(.:format)      devise/sessions#destroy
             user_password POST   /users/password(.:format)      devise/passwords#create
         new_user_password GET    /users/password/new(.:format)  devise/passwords#new
        edit_user_password GET    /users/password/edit(.:format) devise/passwords#edit
                           PUT    /users/password(.:format)      devise/passwords#update
  cancel_user_registration GET    /users/cancel(.:format)        devise/registrations#cancel
         user_registration POST   /users(.:format)               devise/registrations#create
     new_user_registration GET    /users/sign_up(.:format)       devise/registrations#new
    edit_user_registration GET    /users/edit(.:format)          devise/registrations#edit
                           PUT    /users(.:format)               devise/registrations#update
                           DELETE /users(.:format)               devise/registrations#destroy
                     notes GET    /notes(.:format)               notes#index
                           POST   /notes(.:format)               notes#create
                  new_note GET    /notes/new(.:format)           notes#new
                 edit_note GET    /notes/:id/edit(.:format)      notes#edit
                      note GET    /notes/:id(.:format)           notes#show
                           PUT    /notes/:id(.:format)           notes#update
                           DELETE /notes/:id(.:format)           notes#destroy
                      root        /                              notes#index
  
  Process finished with exit code 0
  </code></pre>
  
  <p><strong>EDIT: SOLUTION</strong></p>
  
  <pre><code>class Api::RegistrationController &lt; Devise::RegistrationsController
    skip_before_filter :verify_authenticity_token
    respond_to :json
  
    def register
      build_resource(sign_up_params)
      if resource.save
        render :json =&gt; {:result =&gt; 'OK'}
      else
        render :json =&gt; {:result =&gt; 'ERROR'}
      end
    end
  end
  </code></pre>
  
  <p>Also had to change routes.rb:</p>
  
  <pre><code>devise_scope :user do
      post "api/register" =&gt; "api/registration#register"
    end
    devise_for :users
  .
  .
  .
  </code></pre>