Guest User

Untitled

a guest
Oct 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class User < ActiveRecord::Base
  2. attr_accessible :email, :first_name, :last_name, :username
  3.  
  4. before_validation :lol, :on => :create
  5. before_validation :yay, :on => :create
  6. before_validation :yay, :on => :update
  7.  
  8. def lol
  9. puts "Running lol"
  10. end
  11.  
  12. def yay
  13. puts "Running yay"
  14. end
  15. end
  16.  
  17. a = User.new()
  18. a.save!
  19.  
  20. ...
  21. only prints
  22. Running lol
Add Comment
Please, Sign In to add comment