diff --git a/app/models/concerns/post_validations.rb b/app/models/concerns/post_validations.rb index e202e5fc9..9b8fa745a 100644 --- a/app/models/concerns/post_validations.rb +++ b/app/models/concerns/post_validations.rb @@ -3,6 +3,10 @@ module PostValidations extend ActiveSupport::Concern included do + normalizes :body_markdown, with: lambda { |body_markdown| + body_markdown.encode(body_markdown.encoding, universal_newline: true) + } + validate :tags_in_tag_set, if: -> { post_type.has_tags } validate :maximum_tags, if: -> { post_type.has_tags } validate :maximum_tag_length, if: -> { post_type.has_tags } diff --git a/app/models/post.rb b/app/models/post.rb index 60a4505d7..6b8f12b94 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -31,10 +31,6 @@ class Post < ApplicationRecord serialize :tags_cache, coder: YAML, type: Array - normalizes :body_markdown, with: lambda { |body_markdown| - body_markdown.encode(body_markdown.encoding, universal_newline: true) - } - validates :body, presence: true, length: { maximum: 65_535 } validates :body_markdown, presence: true, length: { maximum: 30_000 } validates :doc_slug, uniqueness: { scope: [:community_id], case_sensitive: false }, if: -> { doc_slug.present? }