Rails – Devise send user email after sign_up/create

Confirmation emails should be sent from the controller. It’s simple to override the Devise::RegistrationsController defaults.

Create the file app/controllers/my_registrations_controller.rb (name this whatever you want)

class MyRegistrationsController < Devise::RegistrationsController

  def create
    super
    if @user.persisted?
      UserMailer.new_registration(@user).deliver
    end
  end

end

Then in your routes:

devise_for :users, :controllers => { :registrations => "my_registrations" }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)