Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Comments on How to allow sign-ups without confirmation as an exception using devise confirmable?
Post
How to allow sign-ups without confirmation as an exception using devise confirmable?
I use the devise authentication gem for a Rails application and it's very convenient.
Typically I want my users to confirm their registration by email. Therefore the User
model looks like
class User < ApplicationRecord
devise :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable,
and it works like a charm. All users wanting to sign up must confirm their registration.
Now, as an exception, I sometimes also want to sign up users without confirmation at all. For example, imagine an administrator that creates new users on the fly.
How do I do that?
I tried to create a new user and with user.skip_confirmation!
from the documentation of confirmable I can finish the confirmation, but the confirmation email gets send out anyway when the user is created. I want to skip the confirmation and not send that email.
How can I optionally suppress the whole confirmation process including sending out of an email if I use :confirmable
otherwise?
Maybe some kind of pre-confirmation is possible?
Searching for this only delivered general configuration information for devise.
1 comment thread