lib/simple_states.rb in simple_states-1.1.0.rc2 vs lib/simple_states.rb in simple_states-1.1.0.rc3
- old
+ new
@@ -69,9 +69,15 @@
def state
super.try(:to_sym)
end
+ def reset_state
+ self.state = self.class.initial_state
+ states = self.class.state_names - [self.class.initial_state]
+ states.each { |state| self.send(:"#{state}_at=", nil) if respond_to?(:"#{state}_at=") }
+ end
+
def past_states
@past_states ||= []
end
def state?(state, include_past = false)