DEV Community

a-laz
a-laz

Posted on

Rails 7 ActionController::UnknownFormat in CommentsController#create respond_to

I have a comments controller that i want to load a partial "create.js.erb"

class CommentsController < ApplicationController
    skip_before_action :verify_authenticity_token
    def create
        @comment = Comment.new(comment_params)
        @comment.account_id = current_account.id

        respond_to do |format|
            if @comment.save
                @comments = Comment.where(post_id: @comment.post_id)
                format.js { render "comments/create" }
            else
                # unable to save
            end
        end
    end

    def

Latest comments (0)