class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
has_rich_text :body
class Comment < ApplicationRecord
belongs_to :commentable, polymorphic: true
belongs_to :author, class_name: "User"
scope :visible, -> { where(deleted_at: nil).order(:created_at) }
class Board < ApplicationRecord
has_many :cards, dependent: :destroy
belongs_to :owner, class_name: "User"
validates :name, presence: true
end
class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
validates :body, presence: true, length: { maximum: 5_000 }
<%= tag.div id: dom_id(comment), class: "comment", data: { controller: "comment" } do %>
<div class="comment__body">
<%= comment.body %>
</div>
<footer class="comment__meta">
class Comment < ApplicationRecord
belongs_to :post
belongs_to :author, class_name: "User"
validates :body, presence: true