code-quality

Devise - create confirmed user account without sending out an email?

Devise - create confirmed user account without sending out an email?

rubocop
Devise - create confirmed user account without sending out an email?

So you integrated devise in your app and need your email signups to confirm. You setup devise and enabled confirmable module and things were going great.

One day your manager comes to you all excited about having social logins(Facebook, twitter, linkedin) and you no longer need them to confirm. Or it may be that your application now has email invitation feature and it would be stupid to ask the user you just invited via email to confirm their email.

It is now time to skip confirmation mail.

For this you will have to detect the mechanism by which user is being created and If it is among above two cases you can add one more line user.skip_confirmation! before saving the user.

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

Did this work for you? Do you have some more edge case related to this? Feel free to share in the comments below.

Happy Coding!

Reference: https://stackoverflow.com/a/7465664/4096120

About the author

Prakash Poudel Sharma

Engineering Manager · Product Owner · Varicon

Engineering Manager at Varicon, leading the Onboarding squad as Product Owner. Eleven years of building software — first as a programmer, then as a founder, now sharpening the product craft from the inside of a focused team.

Keep reading

More on this

Join the conversation0 comments

What did you take away?

Thoughts, pushback, or a story of your own? Drop a reply below — I read every one.

Comments are powered by Disqus. By posting you agree to theirterms.

0:000:00