Files
fizzy/app/controllers/comments_controller.rb
T
2024-09-04 14:54:11 -04:00

20 lines
409 B
Ruby

class CommentsController < ApplicationController
before_action :set_bubble
def create
@comment = @bubble.comments.create(comment_params)
@comment.save
redirect_to bubble_path(@bubble, anchor: "comment_#{@comment.id}")
end
private
def comment_params
params.require(:comment).permit(:body)
end
def set_bubble
@bubble = Bubble.find(params[:bubble_id])
end
end