lib/transitions/machine.rb in transitions-0.1.1 vs lib/transitions/machine.rb in transitions-0.1.2

- old
+ new

@@ -37,11 +37,11 @@ def update(options = {}, &block) @initial_state = options[:initial] if options.key?(:initial) @auto_scopes = options[:auto_scopes] instance_eval(&block) if block - include_scopes if @auto_scopes && defined?(ActiveRecord::Base) && @klass < ActiveRecord::Base + include_scopes if @auto_scopes && ::Transitions.active_record_descendant?(klass) self end # TODO Refactor me please? def fire_event(event, record, persist, *args) @@ -52,10 +52,10 @@ if record.respond_to?(:event_fired) record.send(:event_fired, record.current_state, new_state, event) end - record.current_state(new_state, persist) + record.update_current_state(new_state, persist) @events[event].success.call(record) if @events[event].success return true else record.send(:event_failed, event) if record.respond_to?(:event_failed) return false