title: Devise 'Unknown action' when overwriting registration controller
body: <p>I'm trying to overwrite <code>Devise</code> registration controller and here is my setup:</p>
  <p><strong>registrations_controller.rb</strong></p>
  <pre><code>class RegistrationsController &lt; Devise::RegistrationsController
    before_filter :authenticate_user!, :only =&gt; :token
  
    def new
      super
    end
  
    def create
      @request.env[&quot;devise.mapping&quot;] = Devise.mappings[:user]
      @user = User.new(params[:user])
  
      if @user.save
        render 'create.js', :success =&gt; true
      else
        render 'create.js', :success =&gt; false
      end
    end
  end
  </code></pre>
  <p><strong>routes.rb</strong></p>
  <pre><code>(...)
  devise_for :users, :controllers =&gt; {:sessions =&gt; 'sessions', :registrations =&gt; 'registrations'}
  match 'registrations/create'        =&gt; 'registrations#create'   , :as =&gt; :user_register
  # not matter if i'll put `match 'registrations/create'` line above or under the `devise_for` line
  (...)
  </code></pre>
  <p>And it all (when i'll point my browser to <code>registrations/create</code>) gives me an error:</p>
  <blockquote>
  <h2>Unknown action</h2>
  <p>Could not find devise mapping for path &quot;/registrations/create&quot;. This
  may happen for two reasons: 1) You forgot to wrap your route inside
  the scope block. For example: devise_scope :user do match
  &quot;/some/route&quot; =&gt; &quot;some_devise_controller&quot; end 2) You are testing a
  Devise controller bypassing the router. If so, you can explicitly tell
  Devise which mapping to use: @request.env[&quot;devise.mapping&quot;] =
  Devise.mappings[:user]</p>
  </blockquote>
  <p>I've found some threads describing similar issue but they were not helpfull at all. Thank you for any advice!</p>