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-fl开发者_JS百科y. (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
精彩评论