Sha256: 28eccc1f70cf2819272371a8cf77e4b36ccc51ce01e34b04d320bb3472190adb
Contents?: true
Size: 472 Bytes
Versions: 6
Compression:
Stored size: 472 Bytes
Contents
module C80NewsTz class BannerValidator < ActiveModel::Validator def validate(record) unless record.title.present? record.errors[:title] = 'Укажите название' end unless record.href.present? record.errors[:href] = 'Укажите ссылку' end unless record.image.present? record.errors[:image] = 'Загрузите картинку' end puts record.errors.as_json end end end
Version data entries
6 entries across 6 versions & 1 rubygems