Skip to content

Instantly share code, notes, and snippets.

@gnufied
Created June 15, 2012 09:42
Show Gist options
  • Save gnufied/2935637 to your computer and use it in GitHub Desktop.
Save gnufied/2935637 to your computer and use it in GitHub Desktop.
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