Gawyn
Gawyn

Reputation: 1156

Disable Devise confirmable mails

Recently I added the confirmable module to my User class. I already have a quite nice mailing system (Sidekiq, Sendgrid...) in my app, so I created my own "confirm account" mail. The problem now is to disable Devise from sending its default email. Is there any way to completely disable the Devise mailing system?

Added:

Upvotes: 20

Views: 15133

Answers (6)

Govind shaw
Govind shaw

Reputation: 427

remove (:confirmable) from devise model ex:- here my devise model is User here I used like this.

class User < ActiveRecord::Base  
     devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable,:omniauthable

end

Upvotes: 0

kon_yu
kon_yu

Reputation: 184

I recommend you

User.skip_reconfirmation!

That is skip confirm mail and update email not to use "confirm!"

Upvotes: 2

Thilo
Thilo

Reputation: 17735

Use the source, Luke:

# lib/devise/models/confirmable.rb

# A callback method used to deliver confirmation
# instructions on creation. This can be overriden
# in models to map to a nice sign up e-mail.
def send_on_create_confirmation_instructions
  send_devise_notification(:confirmation_instructions)
end

So override this method in your model to do nothing.

Upvotes: 44

Santosh
Santosh

Reputation: 1261

Use skip_confirmation! method before saving any object.

def create
  @user = User.new(params[:user])
  @user.skip_confirmation!
  @user.save!
end

Upvotes: 7

toashd
toashd

Reputation: 1002

Try overriding the following devise method in your model:

def confirmation_required?
  !confirmed?
end

or use skip_confirmation!:

user = User.new(params) 
user.skip_confirmation! 
user.save! 

Upvotes: 8

Richlewis
Richlewis

Reputation: 15374

I think just removing

:confirmable

from the user model should do it

or have you tried disabling

config/environments/development.rb

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

Upvotes: 2

Related Questions