In modern versions of ActiveRecord you can define any number of before_validation
handlers using a simple declaration:
class MyModel < ActiveRecord::Base
before_validation :do_something
before_validation :do_something_else
end
Using Sequel it looks like the only way you can do this is similar to the older ActiveRecord method:
class MyModel < Sequel::Model
def before_validation
super
do_something
do_something_else
end
end
Is there a plugin that adds the simplified declarations, or is that just how it is? The Sequel documentation doesn't paint a very clear picture. There is no MyModel.before_validation
class method defined.
Update: As the answers below indicate, this behavior is not present by default. I've made a Sequel::Model plugin that fixes this called sequel_simple_callbacks