Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add a validation to check if the value is not negative

Behrokh Satarnejad2bf07efdd79c
diff --git a/app/models/relation.rb b/app/models/relation.rb
index 576b235e291..4a5bf201f0a 100644
--- a/app/models/relation.rb
+++ b/app/models/relation.rb
@@ -103,7 +103,7 @@ class Relation < ApplicationRecord
scope :follows_with_lag,
-> { follows.where("lag > 0") }
- validates :lag, numericality: { allow_nil: true, less_than_or_equal_to: 2_147_483_647 }
+ validates :lag, numericality: { allow_nil: true, less_than_or_equal_to: 2_147_483_647, greater_than_or_equal_to: 0 }
validates :to, uniqueness: { scope: :from }