Skip to content

Commit

Permalink
Fixes - 38044 - Don't accept negative values for OS major version
Browse files Browse the repository at this point in the history
  • Loading branch information
girijaasoni committed Nov 26, 2024
1 parent 8e97632 commit 48a3448
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/operatingsystem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Operatingsystem < ApplicationRecord
accepts_nested_attributes_for :os_default_templates, :allow_destroy => true,
:reject_if => :reject_empty_provisioning_template

validates :major, numericality: true, presence: { message: N_("Operating System version is required") }
validates :major, numericality: {:greater_than_or_equal_to => 0, :message => N_("Major version should be greater than or equal to 0") }, presence: { message: N_("Operating System version is required") }
validates :minor, format: { with: /\A\d+(\.\d+)*\z/, message: "Operating System minor version must be in N or N.N format" }, allow_blank: true
has_many :os_parameters, :dependent => :destroy, :foreign_key => :reference_id, :inverse_of => :operatingsystem
has_many :parameters, :dependent => :destroy, :foreign_key => :reference_id, :class_name => "OsParameter"
Expand Down

0 comments on commit 48a3448

Please sign in to comment.