6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/coplan/comments_controller.rb', line 6
def create
authorize!(@plan, :show?)
= @thread..create!(
author_type: "human",
author_id: current_user.id,
body_markdown: params[:comment][:body_markdown]
)
Broadcaster.append_to(
@plan,
target: ActionView::RecordIdentifier.dom_id(@thread, :comments),
partial: "coplan/comments/comment",
locals: { comment: }
)
respond_to do |format|
format.turbo_stream { render turbo_stream: [] }
format.html { redirect_to plan_path(@plan), notice: "Reply added." }
end
end
|