I have an API method that's implemented just like this:
def change_status_operacao
if @user.change_status_operacao(params[:status], params[:empilhadeira_id].to_i, params[:motivo_id].to_i)
emp = ModeloEmpilhadeira.find(params[:empilhadeira_id].to_i)
ActionCable.server.broadcast "filas", {fila: "aguardando", object_dom: render(partial: "application/operacao_detalhe", locals:{ empilhadeira: emp})}
render json: { message: I18n.t("app.change_status_success") }, status: 200
else
render json: { errors: I18n.t("app.change_status_error") }, status: 400
end
end
The problem is, when I'm doing render(partial: "application/operacao_detalhe", locals:{ empilhadeira: emp})
for rendering a html content for my action cable channel, it seems to be responding my api call with that content, instead of the render right bellow, with 200 code. If I take out that broadcast, it works correctly, but I need to pass that html rendered to my channel. So how can I call that render method so it doesn't respond to the api call?