You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pluginaw...@googlegroups.com
Is it possible to chain transitions to create a workflow?
For example
state_machine :state, :initial => :initialized do
event :find_item do
transition :initialized => :finding_item
end
after_transition :initialized => :finding_item do |order, trans|
if product = Item.find(12)
transition :finding_item => :item_found
else
transition :finding_item => :item_not_found
end
end
after_transition :finding_item => :item_not_found do |order, trans|
#email item not found
end
Bill Burcham
unread,
Mar 6, 2013, 9:33:43 AM3/6/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pluginaw...@googlegroups.com
Close. You could do this:
event :item_found do
transition :finding_item => :item_found
end
event :item_not_found do
transition :finding_item => :item_not_found
end
...
if product = Item.find(12)
order.item_found
else
order.item_not_found
end
I used event names that match the state names which I feel is generally a bad practice, or at least a side-effect of a bad design. But you get the idea.