Created
February 4, 2015 19:12
-
-
Save madzhuga/9250155106b242bdadd1 to your computer and use it in GitHub Desktop.
Rails Workflow Engine operation template example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DemoTemplates | |
class StockProvisioning < Workflow::OperationTemplate | |
def resolve_dependency operation | |
resource = operation.data[:resource] | |
# resource is order. | |
# for every order line we check if product needs provisioning | |
# (if it's amount lower that provisioning limit) | |
resource.order_lines.map(:product).any?{|p| p.need_provisioning? } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment