No commit activity in last 3 years
No release in over 3 years
Lets you use the Workflow gem with your Mongoid documents to add state machine functionality.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 2.6.0

Runtime

~> 1.0
 Project Readme

workflow_on_mongoid is deprecated¶ ↑

Please use a state machine like github.com/pluginaweek/state_machine which supports Mongoid. It’s been great working on workflow_on_mongoid over the years, but I no longer have the time to support the gem. Since there is no plugin mechanism in the original workflow gem, keeping workflow_on_mongoid up-to-date and tested has become increasingly difficult. At the same time, I’ve had less and less free time to devote to open source projects. Thanks for your support!

<img src=“https://secure.travis-ci.org/bowsersenior/workflow_on_mongoid.png?branch=master” alt=“Build Status” />

Overview¶ ↑

About workflow_on_mongoid¶ ↑

workflow_on_mongoid lets you use the Workflow gem with your Mongoid documents to add state machine functionality.

How to use it¶ ↑

In your Gemfile, instead of

gem 'workflow'

do

gem 'workflow_on_mongoid'

That is all. Now you can use Workflow with your Mongoid documents. Of course, you can still continue to use Workflow with ActiveRecord, Remodel and plain objects. All that workflow_on_mongoid does is to add Mongoid support. You can use all the features of Workflow with Mongoid models, including reflection of events & states, transition hooks, support for inherited models, etc. Just refer to the Workflow docs.

Versioning¶ ↑

The version numbers of workflow_on_mongoid track the latest supported version of Workflow . The major version number (x.x.x) matches the latest supported version of the Workflow gem, while the minor version number (0.7.0.y) tracks changes to workflow_on_mongoid itself.

Example¶ ↑

class MongoidImage
  include Mongoid::Document

  field :title
  field :status

  include Workflow    # Note this *must* occur after at least one
                      # Mongoid::* include, otherwise your status will not be persisted.

  workflow_column :status

  workflow do
    state :unconverted do
      event :convert, :transitions_to => :converted
    end
    state :converted
  end
end

See the tests for Mongoid for more examples. Do ensure your include Workflow line occurs after at least one Mongoid::Include line.

Tests¶ ↑

I’ve included all the tests from the original workflow gem and added comprehensive tests for Mongoid support, which is now as well-tested as ActiveRecord support. Including the existing tests ensures that workflow_on_mongoid implements support for Mongoid documents without breaking anything.

Project Info¶ ↑

workflow_on_mongoid is hosted on Github: github.com/bowsersenior/workflow_on_mongoid . It’s a tiny project, but your contributions, forkings, comments and feedback are definitely appreciated.

Contributors¶ ↑

Special thanks to:

Copyright © 2011 Mani Tadayon, released under the MIT License