Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails 4 1 branch #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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