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

Version Path
c80_news_tz-0.1.1.26 app/models/c80_news_tz/banner_validator.rb
c80_news_tz-0.1.1.25 app/models/c80_news_tz/banner_validator.rb
c80_news_tz-0.1.1.24 app/models/c80_news_tz/banner_validator.rb
c80_news_tz-0.1.1.23 app/models/c80_news_tz/banner_validator.rb
c80_news_tz-0.1.1.22 app/models/c80_news_tz/banner_validator.rb
c80_news_tz-0.1.1.21 app/models/c80_news_tz/banner_validator.rb