mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
806255b3c4
introduce a couple of custom validators fix minor discrepancies in tests copy I18n error message keys to default location clean up validation invocation move some responsibilities out of validator into class
9 lines
280 B
Ruby
9 lines
280 B
Ruby
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
|