public
Description: Adds support for creating state machines for attributes on any Ruby class
Homepage: http://www.pluginaweek.org
Clone URL: git://github.com/pluginaweek/state_machine.git
state_machine / CHANGELOG.rdoc
100644 105 lines (82 sloc) 5.219 kb

master

  • Add without_#{attribute} named scopes (opposite of the existing with_#{attribute} named scopes) [Sean O’Brien]

0.3.1 / 2008-10-26

  • Fix the initial state not getting set when the state attribute is mass-assigned but protected
  • Change how the base module is included to prevent namespacing conflicts

0.3.0 / 2008-09-07

  • No longer allow additional arguments to be passed into event actions
  • Add support for can_#{event}? for checking whether an event can be fired based on the current state of the record
  • Don’t use callbacks for performing transitions
  • Fix state machines in subclasses not knowing what states/events/transitions were defined by superclasses
  • Replace all before/after_exit/enter/loopback callback hooks and :before/:after options for events with before_transition/after_transition callbacks, e.g.

    before_transition :from => ‘parked’, :do => :lock_doors # was before_exit :parked, :lock_doors after_transition :on => ‘ignite’, :do => :turn_on_radio # was event :ignite, :after => :turn_on_radio do

  • Always save when an event is fired even if it results in a loopback [Jürgen Strobel]
  • Ensure initial state callbacks are invoked in the proper order when an event is fired on a new record
  • Add before_loopback and after_loopback hooks [Jürgen Strobel]

0.2.1 / 2008-07-05

  • Add more descriptive exceptions
  • Assume the default state attribute is "state" if one is not provided
  • Add :except_from option for transitions if you want to blacklist states
  • Add PluginAWeek::StateMachine::Machine#states
  • Add PluginAWeek::StateMachine::Event#transitions
  • Allow creating transitions with no from state (effectively allowing the transition for any from state)
  • Reduce the number of objects created for each transition

0.2.0 / 2008-06-29

  • Add a non-bang version of events (e.g. park) that will return a boolean value for success
  • Raise an exception if the bang version of events are used (e.g. park!) and no transition is successful
  • Change callbacks to act a little more like ActiveRecord
  • Avoid using string evaluation for dynamic methods

0.1.1 / 2008-06-22

  • Remove log files from gems

0.1.0 / 2008-05-05

  • Completely rewritten from scratch
  • Renamed to state_machine
  • Removed database dependencies
  • Removed models in favor of an attribute-agnostic design
  • Use ActiveSupport::Callbacks instead of eval_call
  • Remove dry_transaction_rollbacks dependencies
  • Added functional tests
  • Updated documentation

0.0.1 / 2007-09-26

  • Add dependency on custom_callbacks
  • Move test fixtures out of the test application root directory
  • Improve documentation
  • Remove the StateExtension module in favor of adding singleton methods to the stateful class
  • Convert dos newlines to unix newlines
  • Fix error message when a given event can’t be found in the database
  • Add before_#{action} and #{action} callbacks when an event is performed
  • All state and event callbacks can now explicitly return false in order to cancel the action
  • Refactor ActiveState callback creation
  • Refactor unit tests so that they use mock classes instead of themselves
  • Allow force_reload option to be set in the state association
  • Don’t save the entire model when updating the state_id
  • Raise exception if a class tries to define a state more than once
  • Add tests for PluginAWeek::Has::States::ActiveState
  • Refactor active state/active event creation
  • Fix owner_type not being set correctly in active states/events of subclasses
  • Allow subclasses to override the initial state
  • Fix problem with migrations using default null when column cannot be null
  • Moved deadline support into a separate plugin (has_state_deadlines).
  • Added many more unit tests.
  • Simplified many of the interfaces for maintainability.
  • Added support for turning off recording state changes.
  • Removed the short_description and long_description columns, in favor of an optional human_name column.
  • Fixed not overriding the correct equality methods in the StateTransition class.
  • Added to_sym to State and Event.
  • State#name and Event#name now return the string version of the name instead of the symbol version.
  • Added State#human_name and Event#human_name to automatically figure out what the human name is if it isn’t specified in the table.
  • Updated manual rollbacks to use the new Rails edge api (ActiveRecord::Rollback exception).
  • Moved StateExtension class into a separate file in order to help keep the has_state files clean.
  • Renamed InvalidState and InvalidEvent exceptions to StateNotFound and EventNotFound in order to follow the ActiveRecord convention (i.e. RecordNotFound).
  • Added StateNotActive and EventNotActive exceptions to help differentiate between states which don’t exist and states which weren’t defined in the class.
  • Added support for defining callbacks like so:

    def before_exit_parked end

    def after_enter_idling end

  • Added support for defining callbacks using class methods:

    before_exit_parked :fasten_seatbelt

  • Added event callbacks after the transition has occurred (e.g. after_park)
  • State callbacks no longer receive any of the arguments that were provided in the event action
  • Updated license to include our names.