Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Callbacks

Dynamoid also employs ActiveModel callbacks. Right now the following callbacks are supported:

  • save (before, after, around)
  • create (before, after, around)
  • update (before, after, around)
  • validation (before, after)
  • destroy (before, after, around)
  • after_touch
  • after_initialize
  • after_find

Example:

class User
  include Dynamoid::Document

  # ...

  before_save :set_default_password
  after_create :notify_friends
  after_destroy :delete_addresses
end