-
Notifications
You must be signed in to change notification settings - Fork 74
Example Workflows
go2null edited this page May 25, 2015
·
19 revisions
Here is a basic workflow rule that should be the last enabled one. It is used to provide a generic message in addition to the specific errors raised by the various workflows.
# = before_save = #
raise WorkflowError, 'Errors found. Please contact the Admin for assistance as required.' unless errors.blank?# Add authors/updaters to Watchers
#
# Sets: Watcher
# = before_save = #
if subject.present?
self.add_watcher(User.current) unless watched_by?(User.current)
end# returns icf.value if visible, else nil
def visible_custom_value(icf)
visible_custom_field_values(User.current)\
.find { |cfv| cfv.custom_field == icf }
end
# returns icf.value if editable, else nil
def editable_custom_value(icf)
editable_custom_field_values(User.current)
.find { |cfv| cfv.custom_field == icf }
end