Devise is a Ruby library that provides me with this User
class:
class User < ActiveRecord::Base
has_many :user_tokens
devise :trackable, :confirmable
When :confirmable
is written, a confirmation email is sent upon registration.
Last week I had to batch-create 300 users, so I commented out :confirmable
for a few minutes before reverting.
Now I am creating a UI for user batch-creation, so I need to add/remove :confirmable
on-the-fly. (I could also modify Devise's source code directly but I would rather not temper with it)
QUESTION: How to add/remove :confirmable
on-the-fly?
Solution by Wayne Conrad:
user = User.new
user.skip_confirmation!
http://rubydoc.info/github/plataformatec/devise/master/Devise/Models/Confirmable#skip_confirmation!-instance_method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With