I'm using ruote and ruote-amqp from within a Rails app via ruote-kit
(basing my app on http://github.com/threetee/ruote-rails-example). I'd
like to be able to execute Ruby code from within my process definition
so that I can call methods on my Rails models. It doesn't seem to be a
problem to include Ruby code in the process definition, but I'm having
trouble figuring out how to reference workitem fields from the pdef.
Example:
----------------------
# In the model:
servers = Server.all
PDEF = Ruote.process_definition :name => 'create_email' do
cursor do
approver :task => 'approve_email'
cancel_process :if => '${account_denied}'
# Set the state to 'provisioning' - this doesn't work
# Email.find(eval('${object_id}')).begin_provisioning
# Provision the account on the ingress servers
concurrence do
servers.each do |server|
remote_server :command => '/account/disable', :queue =>
"ruote_uuid-#{server.uuid}"
end
end
end
end
# Launch the process
@email = Email.create(:address => '[email protected]')
RuoteKit.engine.launch(PDEF, :address => @email.address, :object_type
=> :email, :object_id => @email.id)
---------------------
In the above example, iterating over the servers AR results works
properly, but I can't figure out how to reference the object_id field
from the workitem (see the commented Email.find). Anybody have any
tips on how to do this properly?
Thanks in advance for any assistance!
--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en