Add ability to manage which websites can credit you in link previews (#31819)
This commit is contained in:
parent
3929e3c6d2
commit
e0c27a5047
92 changed files with 381 additions and 160 deletions
9
app/validators/lines_validator.rb
Normal file
9
app/validators/lines_validator.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue