Fix position validation [SCI-11050]

This commit is contained in:
Martin Artnik 2024-09-13 15:34:54 +02:00
parent ddc7cf9bf6
commit dd2499a70c

View file

@ -29,7 +29,7 @@ class StorageLocationRepositoryRow < ApplicationRecord
def ensure_uniq_position
if storage_location.storage_location_repository_rows
.where("metadata->>'position' = ?", metadata['position'].to_json.gsub(',', ', '))
.where("metadata->'position' = ?", metadata['position'].to_json)
.where.not(id: id).exists?
errors.add(:base, I18n.t('activerecord.errors.models.storage_location.not_uniq_position'))
end