Sha256: 2faa7464a02357b84f15fce9bd5e5b4768c556142db00a72dd3e67d35e4ab7e2

Contents?: true

Size: 409 Bytes

Versions: 4

Compression:

Stored size: 409 Bytes

Contents

# frozen_string_literal: true
module Decidim
  module Comments
    # A form object used to create comments from the graphql api.
    #
    class CommentForm < Form
      attribute :body, String
      attribute :alignment, Integer

      mimic :comment

      validates :body, presence: true
      validates :alignment, inclusion: { in: [0, 1, -1] }, if: ->(form) { form.alignment.present? }
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
decidim-comments-0.0.2 app/forms/decidim/comments/comment_form.rb
decidim-0.0.2 decidim-comments/app/forms/decidim/comments/comment_form.rb
decidim-comments-0.0.1 app/forms/decidim/comments/comment_form.rb
decidim-0.0.1 decidim-comments/app/forms/decidim/comments/comment_form.rb