Skip to content

Commit

Permalink
[Validator] Remove useless code in AspectRatioValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
Mth0158 committed Oct 22, 2024
1 parent 6d73fdc commit 507b758
Show file tree
Hide file tree
Showing 18 changed files with 0 additions and 22 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ en:
aspect_ratio_not_portrait: "must be a portrait image"
aspect_ratio_not_landscape: "must be a landscape image"
aspect_ratio_is_not: "must have an aspect ratio of %{aspect_ratio}"
aspect_ratio_unknown: "has an unknown aspect ratio"
image_not_processable: "is not a valid image"
```
Expand Down
1 change: 0 additions & 1 deletion config/locales/da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ da:
aspect_ratio_not_portrait: "skal være et portrætbillede"
aspect_ratio_not_landscape: "skal være et landskabsbillede"
aspect_ratio_is_not: "skal have et størrelsesforhold på %{aspect_ratio}"
aspect_ratio_unknown: "har et ukendt størrelsesforhold"
image_not_processable: "er ikke et gyldigt billede"
1 change: 0 additions & 1 deletion config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ de:
aspect_ratio_not_portrait: "muss Hochformat sein"
aspect_ratio_not_landscape: "muss Querformat sein"
aspect_ratio_is_not: "muss ein Bildseitenverhältnis von %{aspect_ratio} haben"
aspect_ratio_unknown: "hat ein unbekanntes Bildseitenverhältnis"
image_not_processable: "ist kein gültiges Bild"
1 change: 0 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ en:
aspect_ratio_not_portrait: "must be a portrait image"
aspect_ratio_not_landscape: "must be a landscape image"
aspect_ratio_is_not: "must have an aspect ratio of %{aspect_ratio}"
aspect_ratio_unknown: "has an unknown aspect ratio"
image_not_processable: "is not a valid image"
1 change: 0 additions & 1 deletion config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ es:
aspect_ratio_not_portrait: "debe ser una imagen vertical"
aspect_ratio_not_landscape: "debe ser una imagen apaisada"
aspect_ratio_is_not: "debe tener una relación de aspecto de %{aspect_ratio}"
aspect_ratio_unknown: "tiene una relación de aspecto desconocida"
image_not_processable: "no es una imagen válida"
1 change: 0 additions & 1 deletion config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ fr:
aspect_ratio_not_portrait: "doit être une image en format portrait"
aspect_ratio_not_landscape: "doit être une image en format paysage"
aspect_ratio_is_not: "doit avoir un rapport hauteur / largeur de %{aspect_ratio}"
aspect_ratio_unknown: "a un rapport d'aspect inconnu"
image_not_processable: "n'est pas une image valide"
1 change: 0 additions & 1 deletion config/locales/it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ it:
aspect_ratio_not_portrait: "l’orientamento dell’immagine deve essere verticale"
aspect_ratio_not_landscape: "l’orientamento dell’immagine deve essere orizzontale"
aspect_ratio_is_not: "deve avere un rapporto altezza / larghezza di %{aspect_ratio}"
aspect_ratio_unknown: "ha un rapporto altezza / larghezza sconosciuto"
image_not_processable: "non è un'immagine valida"
1 change: 0 additions & 1 deletion config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ ja:
aspect_ratio_not_portrait: "は縦長にしてください"
aspect_ratio_not_landscape: "は横長にしてください"
aspect_ratio_is_not: "のアスペクト比は %{aspect_ratio} にしてください"
aspect_ratio_unknown: "のアスペクト比を取得できませんでした"
image_not_processable: "は不正な画像です"
1 change: 0 additions & 1 deletion config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ nl:
aspect_ratio_not_portrait: "moet een staande afbeelding zijn"
aspect_ratio_not_landscape: "moet een liggende afbeelding zijn"
aspect_ratio_is_not: "moet een beeldverhouding hebben van %{aspect_ratio}"
aspect_ratio_unknown: "heeft een onbekende beeldverhouding"
image_not_processable: "is geen geldige afbeelding"
1 change: 0 additions & 1 deletion config/locales/pl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ pl:
aspect_ratio_not_portrait: "musi mieć proporcje portretu"
aspect_ratio_not_landscape: "musi mieć proporcje pejzażu"
aspect_ratio_is_not: "musi mieć proporcje %{aspect_ratio}"
aspect_ratio_unknown: "ma nieokreślone proporcje"
image_not_processable: "nie jest prawidłowym obrazem"
1 change: 0 additions & 1 deletion config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ pt-BR:
aspect_ratio_not_portrait: "não está no formato retrato"
aspect_ratio_not_landscape: "não está no formato paisagem"
aspect_ratio_is_not: "não contém uma proporção de %{aspect_ratio}"
aspect_ratio_unknown: "não tem uma proporção definida"
image_not_processable: "não é uma imagem válida"
1 change: 0 additions & 1 deletion config/locales/ru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ ru:
aspect_ratio_not_portrait: "должно быть портретное изображение"
aspect_ratio_not_landscape: "должно быть пейзажное изображение"
aspect_ratio_is_not: "должен иметь соотношение сторон %{aspect_ratio}"
aspect_ratio_unknown: "имеет неизвестное соотношение сторон"
image_not_processable: "не является допустимым изображением"
1 change: 0 additions & 1 deletion config/locales/sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ sv:
aspect_ratio_not_portrait: "måste vara en porträttorienterad bild"
aspect_ratio_not_landscape: "måste vara en landskapsorienterad bild"
aspect_ratio_is_not: "måste ha en följande aspect ratio %{aspect_ratio}"
aspect_ratio_unknown: "har en okänd aspect ratio"
image_not_processable: "är inte en giltig bild"
1 change: 0 additions & 1 deletion config/locales/tr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ tr:
aspect_ratio_not_portrait: "dikey bir imaj olmalı"
aspect_ratio_not_landscape: "yatay bir imaj olmalı"
aspect_ratio_is_not: "%{aspect_ratio} en boy oranına sahip olmalı"
aspect_ratio_unknown: "bilinmeyen en boy oranı"
image_not_processable: "geçerli bir imaj değil"
1 change: 0 additions & 1 deletion config/locales/uk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ uk:
aspect_ratio_not_portrait: "мусить бути портретне зображення"
aspect_ratio_not_landscape: "мусить бути пейзажне зображення"
aspect_ratio_is_not: "мусить мати співвідношення сторін %{aspect_ratio}"
aspect_ratio_unknown: "має невідоме співвідношення сторін"
image_not_processable: "не є допустимим зображенням"
1 change: 0 additions & 1 deletion config/locales/vi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ vi:
aspect_ratio_not_portrait: "phải là ảnh đứng"
aspect_ratio_not_landscape: "phải là ảnh ngang"
aspect_ratio_is_not: "phải có tỉ lệ ảnh %{aspect_ratio}"
aspect_ratio_unknown: "tỉ lệ ảnh không xác định"
image_not_processable: "không phải là ảnh"
1 change: 0 additions & 1 deletion config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ zh-CN:
aspect_ratio_not_portrait: "必须是竖屏图片"
aspect_ratio_not_landscape: "必须是横屏图片"
aspect_ratio_is_not: "纵横比必须是 %{aspect_ratio}"
aspect_ratio_unknown: "未知的纵横比"
image_not_processable: "不是有效的图像"
5 changes: 0 additions & 5 deletions lib/active_storage_validations/aspect_ratio_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class AspectRatioValidator < ActiveModel::EachValidator # :nodoc
aspect_ratio_not_portrait
aspect_ratio_not_landscape
aspect_ratio_is_not
aspect_ratio_unknown
].freeze
PRECISION = 3.freeze

Expand Down Expand Up @@ -75,10 +74,6 @@ def is_valid?(record, attribute, attachable, metadata)

errors_options[:aspect_ratio] = "#{x}:#{y}"
add_error(record, attribute, :aspect_ratio_is_not, **errors_options)
else
errors_options[:aspect_ratio] = flat_options[:with]
add_error(record, attribute, :aspect_ratio_unknown, **errors_options)
return false
end
end

Expand Down

0 comments on commit 507b758

Please sign in to comment.