diff --git a/.travis.yml b/.travis.yml index 5f08979d..ca11a6e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,7 @@ language: ruby script: "bundle exec rake appraisal:integration test" rvm: - - 1.8.7 - - 1.9.2 - - 1.9.3 + - 2.1.1 - jruby-18mode - jruby-19mode - rbx-18mode diff --git a/lib/state_machine/integrations/active_model.rb b/lib/state_machine/integrations/active_model.rb index db5368c3..8311767e 100644 --- a/lib/state_machine/integrations/active_model.rb +++ b/lib/state_machine/integrations/active_model.rb @@ -396,7 +396,13 @@ 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 # ActiveModel::Observer is available. @@ -509,11 +515,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.