class CommentsController < ApplicationController

  def new
    @comment = Comment.new
  end

end

class CommentsController < ApplicationController

  def new
    @resource = Resource.find_by(id: params[:resource_id])
    @comment = @resource.comments.build
  end

end

Build comment off of resource in new comments action.
Build comment off of resource in new comments action.
