Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
13 changes: 7 additions & 6 deletions lib/state_machine/integrations/active_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down