2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-05-23 00:52:12 -04:00
|
|
|
require 'text_sentinel'
|
|
|
|
require 'text_cleaner'
|
|
|
|
|
|
|
|
class QualityTitleValidator < ActiveModel::EachValidator
|
|
|
|
def validate_each(record, attribute, value)
|
|
|
|
sentinel = TextSentinel.title_sentinel(value)
|
|
|
|
record.errors.add(attribute, :is_invalid) unless sentinel.valid?
|
|
|
|
end
|
|
|
|
end
|