Skip to content

Commit

Permalink
Move arount_validation out of the protected block.
Browse files Browse the repository at this point in the history
This prevents problems like pluginaweek/state_machine#295
albertosaurus committed Jan 20, 2015
1 parent 8204eec commit 67224b4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/enum_state_machine/integrations/active_model.rb
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 67224b4

Please sign in to comment.