I want to do something like this:
class AttachmentsController < ApplicationController
def upload
render :json => { :attachmentPartial => rende
In Rails 6 I think this might be a little different from the accepted answer. I don't think you need to set the underscore in the partial name. This worked for me:
format.json {
html_content = render_to_string(partial: 'admin/pages/content', locals: { page: @page }, layout: false, formats: [:html])
render json: { attachmentPartial: html_content }
}