Devise skip_confirmation! fails to avoid to send the confirmation instructions
You need to skip confirmation before you create the User objects and its persisted to the database. So the user creation part of your method would look like
user = User.new(:username => data.name, :email => data.email, :password => Devise.friendly_token[0,20])
user.skip_confirmation!
user.save
How to get Devise in Rails skip_confirmation to actually not send an email?
Devise's #skip_confirmation!
is misleading. It says "If you don't want confirmation to be sent on create, neither a code to be generated, call skip_confirmation!."
Really what I was looking for in this case was #skip_confirmation_notification!
. The documentation makes the distinction that this "Skips sending the confirmation/reconfirmation notification email after_create/after_update."
This works! To get the above code to not send out a confirmation email, it should look like this:
user = User.new(:username => name, :email => email, :password => password)
user.skip_confirmation_notification!
user.save
Devise gem skip confirmation and skip confirmation via email both at once
You need to call skip_confirmation! before you save the record.
Try
user = User.new(:first_name => "blah")
user.skip_confirmation!
user.save
undefined method skip_confirmation! - devise, omniauth
So if I'm right (not 100% secure), you need to declare that your model has the module confirmable, add the confirmable module:
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :confirmable
And make sure that you have the fields for the confirmable module on your users table, you should have the fields confirmation_token and confirmed_at
If you don't have those fields, check on this answer how to add them.
skip confirmation e-mail in development with devise
try Letter Opener gem from Ryan Bates
https://github.com/ryanb/letter_opener
it will open the email in the browser without sending it. You don't want to be skipping stuff out if you're in development because stuff will get missed/forgotten about.
Devise skip confirmation when using omniauth
Try this with first_or_initialize
:
def self.from_omniauth(auth)
where(provider: auth.provider, uid: auth.uid). first_or_initialize do |user|
user.provider = auth.provider
user.uid = auth.uid
user.first_name = auth.info.first_name
user.last_name = auth.info.last_name
user.email = auth.info.email
user.skip_confirmation!
user.save!
end
end
Related Topics
Share Models Between 2 Rails API's (Separate Applications)
How to Extract the Sign of an Integer in Ruby
Resetting a Singleton Instance in Ruby
What Is the Community-Preferred Ruby Unit Testing Framework
Rails/Rspec: How to Test #Initialize Method
<Rubygems> How to Change Gem Environment Settings
Should I Check in '.Ruby-Gemset' And/Or '.Ruby-Version'
Differencebetween #Encode and #Force_Encoding in Ruby
Normalizing Line Endings in Ruby
How to Escape Strings for Terminal in Ruby
Using Yield Inside Define_Method in Ruby
Carrierwave - Resizing Images to Fixed Width
How to Render a Plain HTML File with Sinatra
How to Convert a JSON String to an Object