Created
January 5, 2010 09:12
-
-
Save Mikr0Tik/269264 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 Person < ActiveRecord::Base | |
before_save :before_save_foo, :before_save_bar | |
before_create :before_create_claat | |
before_validation :before_validation_bar | |
after_save :after_save_clean_skip_callbacks | |
attr_accessor :skip_callbacks | |
def before_save_foo | |
unless skip_callbacks | |
# do something | |
end | |
end | |
def before_save_bar | |
unless skip_callbacks | |
# do something | |
end | |
end | |
def before_create_claat | |
unless skip_callbacks | |
# do something | |
end | |
end | |
def before_validation_foo | |
unless skip_callbacks | |
# do something | |
end | |
end | |
def after_save_clean_skip_callbacks | |
skip_callbacks = false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment