Should I extend or include ActiveModel:Validations:Callbacks:ClassMethods
or ActiveModel:Validations:Callbacks
?
Asked
Active
Viewed 2,322 times
12

K Everest
- 1,565
- 5
- 15
- 23
1 Answers
23
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.

JonnieCache
- 231
- 1
- 3