55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/workflowable/actions/action.rb', line 55
def validate_options
errors = []
current_options = self.class.options(@options, @workflow, @object, @current_stage, @next_stage, @user)
begin
@options.assert_valid_keys(current_options.keys)
rescue ArgumentError=>e
errors << "#{e.message} for action: #{self.class.name}\n"
end
missing_keys = current_options.reject{|k,v| v[:required] != true }.keys - @options.reject{|k,v| v[:value].blank? }.keys
missing_keys.each do |k|
errors << "#{k} is required\n"
end
return errors.blank? ? nil : errors
end
|