Search code examples
ruby-on-railsruby-on-rails-3deviserubygems

Devise gem skip confirmation and skip confirmation via email both at once


I am using devise gem and while creating user I want to skip confimation! and skip confimation email for example:

User.create(:first_name => "vidur", :last_name => "punj").confirm!.skip_confirmation!

But it skips only confirmation and doesn't skip sending confirmation email. Can any one give me an idea to skip both.


Solution

  • You need to call skip_confirmation! before you save the record.

    Try

    user = User.new(:first_name => "blah")
    user.skip_confirmation!
    user.save