Workflow support in Ruby on Rails

Hello,

I am relativley new to Ruby on Rails and am still in the process of
enjoying
the features it offers. I wanted to know if theres workflow support in
rails. Can some one give me pointers if its possible.

Thanks
Naveen

Am Sonntag, den 05.03.2006, 15:06 +0530 schrieb Preethi Naveen:

I am relativley new to Ruby on Rails and am still in the process of
enjoying the features it offers. I wanted to know if theres workflow
support in rails. Can some one give me pointers if its possible.

What are you thinking about?


Norman T.

http://blog.inlet-media.de

What i have in mind is to implement a web based application, where a
document in an organisation can be routed according to some business
process. Lets say a document needs to traverse list of people in an
organisation, user X initiates a document and says forward, so it goes
to user Y who is the next person in the process who does commenting etc
and forwards it where it finally reaches user Z.

Is it possible. Thanks

Naveen

Norman T. wrote:

Am Sonntag, den 05.03.2006, 15:06 +0530 schrieb Preethi Naveen:

I am relativley new to Ruby on Rails and am still in the process of
enjoying the features it offers. I wanted to know if theres workflow
support in rails. Can some one give me pointers if its possible.

What are you thinking about?


Norman T.

http://blog.inlet-media.de

I don’t have any Rails specific advice but I have looked at workflow
systems generically and I’ll back what David said: it is definitely
possible. But it isn’t clear what benefits a ‘workflow’ like module can
provide. At my work we’ve looked at generic workflow type stuff (in
Perl) and had mixed results. The trouble is that ‘workflow’ is a fairly
loose concept and by the time you’ve got a sufficiently flexible
workflow system it begins to look a lot like a programming language.

Workflow can be described as a state transition diagram: any object
passing through the workflow is at any given time in a ‘state’. There
are defined transitions between states. Transitions have conditions that
must be met before that transition can occur.

What we looked for was being able to define all this in a configuration
file which could be semantically validated (so all states had
transitions to an end state, that end states existed, that all
transitions connected between valid states, etc…) and ideally
manipulated by a domain specialist (in our case a Business Analyst) but
not necessarily a programmer. We are almost talking about a Domain
Specific Language here except the control structures are quite limited.

We looked at, and started using the Perl Workflow CPAN module:

This had some nice features: it gave us a language to describe our
workflows, states and transitions. It has data persistence. It has an
API to allow inspection of transitions and their related conditions for
each state- it has some thought put in to it.

It also has some problems. Depending on your data you may not want to
shovel your data through the workflow system- on references to it. But
you also want key data to be available to the workflow system so it can
test transition conditions. And you want to be able to display
information about each object in the workflow.

You also want to be able to give summary information about the objects
in the workflow (17% are in held, 37% are pending approval…) and
you’ll often want to be able to set timers or alarms if something sits
in a state for too long (email: “This document has been pending approval
for 24 hours, please click on the link below to…”). I don’t believe
the Perl Workflow module supported summary information or timers
(although it might now!).

If I were writing a workflow application I’d certainly look over that
module and understand the concepts. But I think any application whose
core functionality is workflow would outgrow most modules pretty
quickly.

Jeremy.

Yes, it’s possible - no, I’m not aware of anyone producing an Engine
or plugin to make it easier to implement. It’s kind of hard to
imagine a generic workflow engine would make things easier to write in
Rails than just starting from scratch anyway.

Workflow support is fairly straightforward to implement in a
database-backed system - you need to have some concept of “states” in
your workflow, and each “document” (i.e. database record) can have one
of several “states” (i.e. values in a field of that database record)
associated with it. Users process the document and change its state
as they do so - that’s how workflow apps work in a nutshell.

When a user logs in, they would be shown a list of “documents”
(database records) that are in a specific “state”, and asked to
process them so the state changes to something else. At that point,
typically the document should appear in another user’s to-do list,
which would appear if/when they log in to the application.

Challenges with workflow apps typically involve:

  • you need to define the set of possible states a document can have
  • you need to define the set of possible state transitions a document
    can go through as it passes through the workflow
  • you need to assign roles/permissions to users so they can interact
    at specific points in the workflow
  • typically, you need to make it relatively easy to change the
    workflow over time

With respect to Rails, I don’t think it would be hard to build
workflow apps with it, but it won’t be competing with commercial tools
such as Remedy, TestDirector and Vignette (which are 3 of many I’ve
used), which make management of the overall workflow quite simple by
hiding what goes on under the covers.

If you have a specific requirement for a workflow app, then it might
be appropriate to build a prototype in Rails to see what’s involved.
If you’re struggling to define how your workflow should work, then
that should raise warning flags - it will almost certainly be more
difficult to maintain your workflow in a Rails app than in one written
in e.g. Remedy, unless you devote lots of time to building the
workflow management tools that Remedy ships with out of the box.

Hope that helps

Dave M.

Hi,

take a look here:

http://raa.ruby-lang.org/cat.rhtml?
category_major=Library;category_minor=Workflow

torrentworkflow looks nice but was last updated in 2001…

Here’s the description from the project page:

database. If any errors occur, then email an administrator. Using
eemail = Torrent::Job.new(“ErrorEmail”, mailTaskObj)

copy.setDependency(ftp)
parse.setDependency(copy)
db.setDependency(parse)
eemail.setDependency(db, Torrent:: FAILURE)
eemail.setDependency(db, Torrent:: AVOIDED)

flow = Torrent::Workflow.new(ftp, copy, parse, db, eemail)
flow.start()

HTH,

Timo

Am 05.03.2006 um 10:36 schrieb Preethi Naveen:

There is a related thread in Workflow + Rails - Rails - Ruby-Forum

Check out
http://lunchroom.lunchboxsoftware.com/articles/2006/01/21/acts-as-state-machine
and http://elitists.textdriven.com/aasm-examples.rb.txt

You can use that plugin to do exactly what you’re describing.