I am using Dropzone with Rails 7 (Stimulus JS). I followed the documentation and somehow the image drag and drop is working fine but as I am integrating dropzone in existing form it is returning me the data in JSON response.
def create
return unless params[:body].present? && @benefit_request.client.present?
Communication::SMS::SendOutboundMessage.call(body: params[:body],
client: @benefit_request.client,
sender: current_user)
# here it is giving me error as it is expecting JSON template
redirect_to request_sms_messages_path(@benefit_request)
end
As I am redirecting to the specific portion using Turbo frame so I do not want to render the whole page.
ActionController::UnknownFormat (Activation::SMSMessagesController#index is missing a template for this request format and variant. request.formats: ["application/json"] request.variant: []):
This is my code and I have tried to change the response using
headers: {
"Content-Type": "application/vnd.turbo_stream"
}
but all in vain. I am not sure how can I pass the response data as turbo_stream
def create return unless params[:body].present? && @benefit_request.client.present?
Communication::SMS::SendOutboundMessage.call(body: params[:body],
client: @benefit_request.client,
sender: current_user)
# here it is giving me error as it is expecting JSON template
redirect_to request_sms_messages_path(@benefit_request)
end