Created
April 3, 2013 16:27
-
-
Save awinabi/5302809 to your computer and use it in GitHub Desktop.
ActiveRecord Callbacks correction
This file contains 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 Bill < ActiveRecord::Base | |
attr_accessible :name | |
before_validation :bvm | |
after_validation :avm | |
before_save :bsm | |
around_save :arsm | |
after_save :asm | |
before_create :bcm | |
around_create :arcm | |
after_create :acm | |
def bvm | |
p '...........before validation call back' | |
return true | |
end | |
def avm | |
p '...........after validation call back' | |
return true | |
end | |
def bsm | |
p '...........before save call back' | |
return true | |
end | |
def arsm | |
p '...........before yield - around save call back' | |
yield | |
p '...........after yield - around save call back' | |
return true | |
end | |
def bcm | |
p '...........before create call back' | |
return true | |
end | |
def arcm | |
p '...........before yield - around create call back' | |
yield | |
p '...........after yield - around create call back' | |
return true | |
end | |
def acm | |
p '...........after create call back' | |
return true | |
end | |
def asm | |
p '...........after save call back' | |
return true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment