lib/simple_states.rb in simple_states-0.0.10 vs lib/simple_states.rb in simple_states-0.0.11

- old
+ new

@@ -11,10 +11,11 @@ extend ActiveSupport::Concern included do class_attribute :state_names, :initial_state, :events + after_initialize :init_state if respond_to?(:after_initialize) self.initial_state = :created self.events = [] end module ClassMethods @@ -45,9 +46,13 @@ self.events += [Event.new(name, options)] end end attr_reader :past_states + + def init_state + self.state = self.class.initial_state + end def past_states @past_states ||= [] end