SHARE
TWEET

Untitled

a guest Feb 19th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. User.create(email: 'test@example.com', encrypted_password: '#$taawktljasktlw4aaglj')
  2.    
  3. user = User.new
  4. user.email = 'test@example.com'
  5. user.encrypted_password = '#$taawktljasktlw4aaglj'
  6. user.save!
  7.    
  8. user.password = 'valid_password'
  9. user.password_confirmation = 'valid_password'
  10.    
  11. user = User.create! :name => 'John Doe', :email => 'john@gmail.com', :password => 'topsecret', :password_confirmation => 'topsecret'
  12.    
  13. def triggerSeedUsers
  14.       p "Starting Seeding Users..."
  15.       p   "Deleting all users"..
  16.       User.destroy_all
  17.       normal_users = [{:email => 'abc@domain.com', :login => "abc_demo", :name => 'abc Demo'}]
  18.       admin_users = [{:email => 'admin@domain.com', :login => 'abc_admin', :name => 'abc Admin'}]
  19.  
  20.       [normal_users,admin_users].each do |user_type|
  21.         user_type.each do |user|
  22.           User.create!(:name => user[:name],
  23.             :login => user[:login],
  24.             :email => user[:email],
  25.             :first_login => false,
  26.             :password => 'P@ssw0rd',
  27.             :password_confirmation => 'P@ssw0rd'
  28.             )
  29.         end
  30.       end
  31.       User.where('name LIKE ?', '%demo%').update_all(:is_admin => 0)
  32.       User.where('name LIKE ?', '%admin%').update_all(:is_admin => 1)
  33.      end
  34.    
  35. user = User.new(
  36.       :email                 => "admin@xxxxx.xxx",
  37.       :password              => "123456",
  38.       :password_confirmation => "123456"
  39.   )
  40.   user.skip_confirmation!
  41.   user.save!
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top