Sha256: 0f87f6812b25a8146fe4bc8bfd17dd84e65d9b7083e6aa3781ee429809a08eda
Contents?: true
Size: 498 Bytes
Versions: 182
Compression:
Stored size: 498 Bytes
Contents
module Katello module Validators class RootRepositoryUniqueAttributeValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) exists = RootRepository.where(:product_id => record.product_id, attribute => value).where("id != ?", record.id || -1).exists? if record.send("#{attribute}_changed?") && record.custom? && exists record.errors[attribute] << _("has already been taken for this product.") end end end end end
Version data entries
182 entries across 182 versions & 1 rubygems