Created
June 15, 2012 09:42
-
-
Save gnufied/2935637 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
attr_accessible :email, :first_name, :last_name, :username | |
before_validation :lol, :on => :create | |
before_validation :yay, :on => :create | |
before_validation :yay, :on => :update | |
def lol | |
puts "Running lol" | |
end | |
def yay | |
puts "Running yay" | |
end | |
end | |
a = User.new() | |
a.save! | |
... | |
only prints | |
Running lol |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment