mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 05:50:14 +08:00
10 lines
280 B
Ruby
10 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
|