title: How to redirect_to root after users/sign_up with devise?
body: <p><em>Running Rails (v7.0.1), ruby (v3.0.1) and added the devise the gem to the Gemfile.</em></p>
  <p>I'm testing the users/sign_up route in the browser on localhost:3000/users/sign_up.
  It successfully saves the user to the database (postgresql)
  I want to redirect_to root after sign_up,
  just like the sign_in currently does, but instead I get:</p>
  <p><strong>NoMethodError in Devise::RegistrationsController#create
  undefined method `user_url' for #Devise::RegistrationsController:0x00000000032988</strong>
  Extracted source (around line #231):
  229
  230
  231
  232
  233
  234</p>
  <pre><code>        if options.empty?
            recipient.public_send(method, *args)
          else
            recipient.public_send(method, *args, options)
          end
  </code></pre>
  <p>Here's the stacktrace:</p>
  <pre><code>Started POST &quot;/users&quot; for ::1 at 2022-02-03 15:06:14 -0600
  Processing by Devise::RegistrationsController#create as TURBO_STREAM
    Parameters: {&quot;authenticity_token&quot;=&gt;&quot;[FILTERED]&quot;, &quot;user&quot;=&gt;{&quot;email&quot;=&gt;&quot;test@test.com&quot;, &quot;password&quot;=&gt;&quot;[FILTERED]&quot;, &quot;password_confirmation&quot;=&gt;&quot;[FILTERED]&quot;}, &quot;commit&quot;=&gt;&quot;Sign up&quot;}
    TRANSACTION (0.2ms)  BEGIN
    User Exists? (0.3ms)  SELECT 1 AS one FROM &quot;users&quot; WHERE &quot;users&quot;.&quot;email&quot; = $1 LIMIT $2  [[&quot;email&quot;, &quot;test@test.com&quot;], [&quot;LIMIT&quot;, 1]]
    User Create (0.5ms)  INSERT INTO &quot;users&quot; (&quot;email&quot;, &quot;encrypted_password&quot;, &quot;reset_password_token&quot;, &quot;reset_password_sent_at&quot;, &quot;remember_created_at&quot;, &quot;created_at&quot;, &quot;updated_at&quot;) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING &quot;id&quot;  [[&quot;email&quot;, &quot;test@test.com&quot;], [&quot;encrypted_password&quot;, &quot;[FILTERED]&quot;], [&quot;reset_password_token&quot;, &quot;[FILTERED]&quot;], [&quot;reset_password_sent_at&quot;, &quot;[FILTERED]&quot;], [&quot;remember_created_at&quot;, nil], [&quot;created_at&quot;, &quot;2022-02-03 21:06:14.495644&quot;], [&quot;updated_at&quot;, &quot;2022-02-03 21:06:14.495644&quot;]]
    TRANSACTION (0.8ms)  COMMIT
  Redirected to
  Completed 500 Internal Server Error in 313ms (ActiveRecord: 1.8ms | Allocations: 7490)
  
  
  
  NoMethodError (undefined method `user_url' for #&lt;Devise::RegistrationsController:0x00000000032988&gt;):
  </code></pre>
  <p>I've tried modifying the Application controller using:</p>
  <p><em>ApplicationController.rb</em></p>
  <pre><code>def after_sign_up_path_for(:user)
   root_path
  end
  </code></pre>
  <p>(<a href="https://github.com/heartcombo/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-out" rel="nofollow noreferrer">https://github.com/heartcombo/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in-out</a>)</p>
  <p>but no luck.</p>
  <p>Also tried <code>rails generate devise:controllers registrations</code> to expose the necessary registrations#create method for tinkering, but haven't cracked it
  (<a href="https://stackoverflow.com/a/41972901/9495921">https://stackoverflow.com/a/41972901/9495921</a>)</p>