Sha256: d5f90cc1dc4b1659686012b488cd9867afe9dd2950b50134341b9864d9996e41

Contents?: true

Size: 543 Bytes

Versions: 11

Compression:

Stored size: 543 Bytes

Contents

module C80News
  class FactValidator < ActiveModel::Validator
    def validate(record)

      unless record.title.present?
        record.errors[:title] = 'Название новости не может быть пустым'
      end

      unless record.short.present?
        record.errors[:short] = 'Заполните краткое описание новости'
      end

      unless record.full.present?
        record.errors[:full] = 'Текст новости не может быть пустым'
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
c80_news-0.1.0.15 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.14 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.13 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.12 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.11 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.10 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.9 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.8 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.7 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.6 app/models/c80_news/fact_validator.rb
c80_news-0.1.0.5 app/models/c80_news/fact_validator.rb