Skip to content

gn2/simple_state_machine_history

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleStateMachineHistory
=========================

I love using AASM (http://github.com/rubyist/aasm/tree/master). However, I sometimes like to keep track of the evolution of my state machines. This is what this plugin does.

First, run the following rake task to add the necessary table in your database.
  rake db:migrate:simple_state_machine_history 

Just add the following in your model:

  state_machine_history

The default column for state is :state. If your state machine is using a different column, you can specify it like this:

  state_machine_history :column => :status_column


Example
=======

class TestStateMachine < ActiveRecord::Base
  include AASM
  aasm_column :state
  aasm_initial_state :pending
  aasm_state :pending
  aasm_state :active
  aasm_event :activate do
    transitions :from => :pending, :to => :active 
  end
  state_machine_history
end


class AnotherTestStateMachine < ActiveRecord::Base
  include AASM
  aasm_column :status_column
  aasm_initial_state :pending
  aasm_state :pending
  aasm_state :active
  aasm_event :activate do
    transitions :from => :pending, :to => :active 
  end
  state_machine_history :column => :status_column
end


Copyright (c) 2009 Adrien (adrien[at]gn2[dot]fr), released under the MIT license

About

Rails plugin to keep a track of your aasm state machines evolution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages