Skip to content

Commit

Permalink
improve errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienMLD authored and clairezed committed May 28, 2024
1 parent 9848db1 commit 3dcc8ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/match_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def experts_subjects

def antenne_or_institution
if antenne.nil? && institution.nil?
errors.add(:base, 'antenne or institution must be present')
errors.add(:antenne_or_institution, :blank, message: I18n.t("activerecord.errors.models.match_filter.attributes.antenne_or_institution.blank"))
end
if antenne.present? && institution.present?
errors.add(:base, 'antenne and institution can’t be present at the same time')
errors.add(:antenne_or_institution, :invalid, message: I18n.t("activerecord.errors.models.match_filter.attributes.antenne_or_institution.invalid"))
end
end

Expand Down
5 changes: 5 additions & 0 deletions config/locales/models.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,11 @@ fr:
landing_themes:
restrict_dependent_destroy:
solicitations: Vous ne pouvez pas supprimer la thématique car des solicitations y font référence
match_filter:
attributes:
antenne_or_institution:
blank: antenne ou institution doit être présente
invalid: antenne et institution ne peuvent être présentes en même temps
solicitation:
attributes:
institution_filters:
Expand Down

0 comments on commit 3dcc8ea

Please sign in to comment.