Ajax editing of comments

I have a rails 5 project and have followed this tutorial to implement


Comments are listed below the instance that they are associated with, I
have creating and deleting comments working with ajax, but I can't work
out how to enable editing with ajax? I have it working with HTML - but
I'd rather be able to do this from the same page the comment is on.

Maybe the way I have this set up (polymorphic commentable objects and
collection of comments on the page) doesn't lend itself to editing like
this? If this is the case I may just leave it as it is, but I'd rather
make this work if its possible.. I've spent a few days trying to get
this to work, but no dice, and I can't find any examples.

Can anyone point me to a decent tutorial or give me some tips as to how
I can achieve this?