Trying to render a modal to update a task but when using remote: true with link_to it just requests html format, I've even checked the request headers which also do not accept js.
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
I'm not really sure what's wrong. I've tried stating the format in the link_to and having a respond_to in the controller but that renders a raw text html rather than executing the js in my .js.haml
Offending code:
View [.html.haml]:
= link_to 'Edit', edit_task_path(task), remote: true
Controller:
def edit
@task = Task.find(params[:id])
render :show_form
end
show_form.js.haml:
:plain
$('#modal1').modal('open');
$('#modal1').html("#{escape_javascript(render partial: 'create_task', locals: {task: @task})});
Also I have all the required libaries included, I even use remote: true else where in the code to submit forms and it all works fine.