Read more

Auto-generate state_machine graphs as PNG images

Henning Koch
September 12, 2011Software engineer at makandra GmbH

The state_machine gem Show archive.org snapshot comes with a rake task that lets you generate PNG graphs from any model using state_machine.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Install the required dependencies like this:

sudo apt-get install graphviz
sudo gem install ruby-graphviz

You can now generate a graph like this:

rake state_machine:draw CLASS=ModelUsingStateMachine

Replace ModelUsingStateMachine with the name of your model class.


If it the raketask does not exist for you, add to Rakefile (in your project root):
require 'tasks/state_machine'

Posted by Henning Koch to makandra dev (2011-09-12 17:59)