diff --git a/lib/enum_state_machine/integrations/active_model.rb b/lib/enum_state_machine/integrations/active_model.rb index 9988ae4..101c550 100644 --- a/lib/enum_state_machine/integrations/active_model.rb +++ b/lib/enum_state_machine/integrations/active_model.rb @@ -396,6 +396,11 @@ def errors_for(object) def reset(object) object.errors.clear if supports_validations? end + + # Runs state events around the object's validation process + def around_validation(object) + object.class.state_machines.transitions(object, action, :after => false).perform { yield } + end protected # Whether observers are supported in the integration. Only true if @@ -509,11 +514,6 @@ def define_validation_hook owner_class.set_callback(:validation, :around, self, :prepend => true) end - # Runs state events around the object's validation process - def around_validation(object) - object.class.state_machines.transitions(object, action, :after => false).perform { yield } - end - # Creates a new callback in the callback chain, always inserting it # before the default Observer callbacks that were created after # initialization.