Class: DespamilatorActiveRecordValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/despamilator_rails.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, text) ⇒ Object



9
10
11
12
# File 'lib/despamilator_rails.rb', line 9

def validate_each(record, attribute, text)
  dspam = Despamilator.new(text)
  record.despamilator_callback(attribute, text, dspam) if dspam.score >= record.despamilator_threshold
end