Guest User

Untitled

a guest
Jan 8th, 2018
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. User.create(:first_name => "vidur", :last_name => "punj").confirm!.skip_confirmation!
  2.  
  3. user = User.new(:first_name => "blah")
  4. user.skip_confirmation!
  5. user.save
  6.  
  7. user = User.new(:first_name => "vidur", :last_name => "punj")
  8. user.skip_confirmation!
  9. user.save!
  10.  
  11. Got the solution:
  12. @user=User.new(:first_name => "vidur", :last_name => "punj")
  13. @user.skip_confirmation!
  14. @user.confirm!
  15. @user.save
  16.  
  17. User.create!(confirmed_at: Time.now, email: 'test@example.com', ...)
  18.  
  19. User.create_with(name: "Mr T", company: "Comp X", password: 'rubyrubyruby', password_confirmation: 'rubyrubyruby', confirmed_at: Time.now).find_or_create_by!( email: 'test@example.com')
  20.  
  21. before_create :my_method
  22.  
  23. def my_method
  24. self.skip_confirmation!
  25. end
  26.  
  27. user = User.new(:first_name => "Gagan")
  28. user.save
Add Comment
Please, Sign In to add comment