How to send reset password instead of confirmation email in Devise?
<p>I am trying to make it so that if a one type of User is created - then instead of sending the confirmations email, it sends the reset password link (I have already achieved so that the reset password link serves as both confirmation and reset password). This is basically a try to avoid duplication of emails since I allow creating a user without password so that the user then can request his first password via reset password.</p>

<p>I am trying to override the Confirmations Controller like so:</p>

<pre><code>class Users::ConfirmationsController &lt; Devise::ConfirmationsController

  def create
    if self.resource.encrypted_password.empty? then
      Users::PasswordsController.create
    else
      super
    end
  end

end
</code></pre>

<p>And in routes:</p>

<pre><code>devise_for :users, controllers: { 
  passwords: 'users/passwords', 
  sessions: 'users/sessions',
  confirmations: 'users/confirmations',
  omniauth_callbacks: 'omniauth_callbacks'
}
</code></pre>

<p>The overriding works with other models. But the create action in confirmations controller is never called. I put a lot of <code>byebug</code> statements all around the Gem itself, and it seems even the original create action is not called, but the email is sent anyway. I am using <code>sidekiq</code> for delayed emails. The only place that is run seems to the mailer:</p>

<pre><code>def confirmation_instructions(record, token, opts={})
  byebug # &lt;- it does stop here
  @token = token
  devise_mail(record, :confirmation_instructions, opts)
end
</code></pre>

<p>But when I check the stack trace, it looks like it's called from some labda function.</p>

<p>The question: why isn't devise using <code>ConfirmationsController</code> and how do I achieve the task at hand?</p>

<p>Thanks a lot!</p>