ruby > thoughts.find_all(&:sfw?).to_blog
 => #<URI::HTTP:0x00001 URL: http://MichaelXavier.net >
ruby > MichaelXavier.info
 =>  [ GitHub , Resume , Email ]
ruby > _

The ActiveRecord Hook Execution Chain
01|05|2010 — 0 comments  

Categories: activerecord, tips

Just thought I'd post some copypasta from the Rails documentation. Rails' documentation is massive and they hide this information where it might be hard to find tidbits like this.

ActiveRecord executes hooks in the following order (source):

  1. save called
  2. valid called
  3. before_validation hook called
  4. before_validation_on_create/before_validation_on_update called
  5. validate called
  6. validate_on_create validate_on_update called
  7. after_validation called
  8. after_validation_on_create/after_validation_on_update called
  9. before_save called
  10. before_create/before_update called
  11. create/update (at last)
  12. after_create/after_update called
  13. after_save called

Comments Comments RSS Feed

Add Comment

(required)
(required, won't be displayed)

(Use Markdown syntax)