module Sequel::Plugins::BeforeAfterSave

  1. lib/sequel/plugins/before_after_save.rb

The before_after_save plugin reorders some internal Sequel operations so they happen before after_create, after_update, and after_save are called, instead of after. These operations are:

  • Resetting the explicit modified flag

  • Refreshing the model or clearing changed columns after creation

This behavior will become the default in Sequel 5.


# Make all model subclasses perform the operations before after_save
Sequel::Model.plugin :before_after_save

# Make the Album class perform the operations before after_save
Album.plugin :before_after_save