Advertisement
Guest User

Untitled

a guest
Jan 13th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. SELECT email FROM users;
  2.  
  3. +-----------------------+
  4. | email |
  5. +-----------------------+
  6. | abc@gmail.com |
  7.  
  8. UPDATE users SET email = 'def@gmail.com' WHERE email = 'abc@gmail.com';
  9.  
  10. SELECT email FROM users;
  11. def@gmail.com
  12.  
  13. user = User.new
  14. user.email = 'xyz@gmail.com'
  15. user.password = 'changeme'
  16. user.password_confirmation = 'changeme'
  17. user.save!
  18. User.pluck :email
  19. => [ "def@gmail.com", "xyz@gmail.com"]
  20. user.email = 'mno@gmail.com'
  21. user.save!
  22. => true
  23. user.email
  24. => "xyz@gmail.com"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement