Skip to content

Commit

Permalink
validate that multi_value is not set unless multi_value_possible? and…
Browse files Browse the repository at this point in the history
… allow_non_open_versions unless allow_non_open_versions_possible?
  • Loading branch information
toy committed Sep 10, 2024
1 parent 6badbd8 commit e0c43c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/models/custom_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def uniqueness_of_name_with_scope
validates :min_length, numericality: { less_than_or_equal_to: :max_length, message: :smaller_than_or_equal_to_max_length },
unless: Proc.new { |cf| cf.max_length.blank? }

validates :multi_value, absence: true, unless: :multi_value_possible?
validates :allow_non_open_versions, absence: true, unless: :allow_non_open_versions_possible?

before_validation :check_searchability
after_destroy :destroy_help_text

Expand Down

0 comments on commit e0c43c4

Please sign in to comment.