Files
fizzy/app/controllers/comments_controller.rb
T
Jason Zimdars 7b2ecf5d1a Anchor to newly created comments
This doesn't actually work but I thought I'd leave it in since it's a reproducible case for: https://github.com/hotwired/turbo/issues/211
2024-08-19 14:16:32 -05:00

20 lines
401 B
Ruby

class CommentsController < ApplicationController
before_action :set_splat
def create
@comment = @splat.comments.create(comment_params)
@comment.save
redirect_to splat_path(@splat, anchor: "comment_#{@comment.id}")
end
private
def comment_params
params.require(:comment).permit(:body)
end
def set_splat
@splat = Splat.find(params[:splat_id])
end
end