Skip to content

Commit

Permalink
change behaviour to revalidate from initial state each time
Browse files Browse the repository at this point in the history
  • Loading branch information
Burke Libbey committed Jun 6, 2011
1 parent e37a63b commit 8ef996a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rule/engine/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ def self.transition(from, to, &blk)
end

def run!(object)
state = self.class.find_state(object.send(@column).try(:to_sym)) || self.class.instance_variable_get("@initial_state")
# state = self.class.find_state(object.send(@column).try(:to_sym)) || self.class.instance_variable_get("@initial_state")
# Revalidate from initial state each time. This is more along the lines of the behaviour dave wants.
state = self.class.instance_variable_get("@initial_state")
loop do
prev_state = state
state = prev_state.next_state(object)
Expand Down

0 comments on commit 8ef996a

Please sign in to comment.