0
0
Fork 0

Add ability to manage which websites can credit you in link previews (#31819)

This commit is contained in:
Eugen Rochko 2024-09-10 14:00:40 +02:00 committed by GitHub
parent 3929e3c6d2
commit e0c27a5047
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
92 changed files with 381 additions and 160 deletions

View file

@ -0,0 +1,9 @@
# frozen_string_literal: true
class LinesValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
return if value.blank?
record.errors.add(attribute, :too_many_lines, limit: options[:maximum]) if options[:maximum].present? && value.split.size > options[:maximum]
end
end