# frozen_string_literal: true require 'booru/config' class CommentValidator < ActiveModel::Validator def validate(record) return if record.body.nil? max_comment_length = Booru::CONFIG.settings[:max_comment_length] record.errors.add(:base, "Too long (#{max_comment_length} characters max).") if max_comment_length && record.body.length > max_comment_length # record.errors.add(:base, 'You need to be logged in to post a comment with links in it.') if record.user.nil? && (['