There is my training project on ruby. I do editing objects using JS. Now it works like this: Edit the first time - everything is fine. Without refreshing the page, I press edit and you can see that the object is rereading, but the form for editing does not appear. I press the third time - everything is fine (Like the first time).
Here is the link to my js code - my repository. Here is this code.
$('.edit-answer-link').click(function(e) { e.preventDefault() $(this).hide() answer_id = $(this).data('answerId') $('form#edit-answer-' + answer_id).show() }); Down there is:
$(document).ready(ready); $(document).on('turbolinks:load', ready); $(document).on('page:update', ready);