Regular callbacks in ActiveRecord::Base
1. before_validation
2. before_validation_on_create
3. after_validation
4. after_validation_on_create
5. before_save
6. before_create
7. after_create
8. after_save
9. before_destroy
10. after_destroy
Usage
class Foo < ActiveRecord::Base
before_create :do_stuff
end
Exceptions
* after_find
* after_initialize
Usage
class Foo < ActiveRecord::Base
def after_find
do_stuff
end
end
cheat sheets.
$ cheat callbacks( add new | see all )
- updated sheets

- mysql_select
- cheat
- cryptsetup
- burm
- perl
- port
- yuilang
- queriac
- mechanize
- sness
- nonsense
- haml
- git
- assert_valid
- marsmission
Advertisement