Skip to content

Commit e79196d

Browse files
awsmsrcRyan Koopmans
authored andcommitted
Moved around_transition out of protected block
cherry-pick commit from pluginaweek#275 so it will work with rails 4.1.
1 parent 88e45a1 commit e79196d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/state_machine/integrations/active_model.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ def reset(object)
397397
object.errors.clear if supports_validations?
398398
end
399399

400+
# Runs state events around the object's validation process
401+
def around_validation(object)
402+
object.class.state_machines.transitions(object, action, :after => false).perform { yield }
403+
end
404+
400405
protected
401406
# Whether observers are supported in the integration. Only true if
402407
# ActiveModel::Observer is available.
@@ -509,11 +514,6 @@ def define_validation_hook
509514
owner_class.set_callback(:validation, :around, self, :prepend => true)
510515
end
511516

512-
# Runs state events around the object's validation process
513-
def around_validation(object)
514-
object.class.state_machines.transitions(object, action, :after => false).perform { yield }
515-
end
516-
517517
# Creates a new callback in the callback chain, always inserting it
518518
# before the default Observer callbacks that were created after
519519
# initialization.

0 commit comments

Comments
 (0)