Should I extend or include ActiveModel:Validations:Callbacks:ClassMethods
or ActiveModel:Validations:Callbacks
?
I got it to work like this:
class Foo
extend ActiveModel::Callbacks
include ActiveModel::Validations
include ActiveModel::Validations::Callbacks
before_validation :bar
def bar
# callback logic here
end
end
It's important that you have everything in that order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With