The script does not connect when I use this code.
show.html.erb
<% content_for :head do %> <%= javascript_include_tag 'comments' %> <% end %> <p> <strong>Title:</strong> <%= @link.title %><br> <strong>Url:</strong> <%= @link.url %><br> <strong>User:</strong> <%= @link.user.email %><br> </p> <%-if user_signed_in?%> <%= render 'comments/new', review: Comment.new(link_id: @link.id) %> <%-end%> <%= render 'comments/show', comments: @comments %> In the query console you can see that it should have loaded, but it is not ...
The script name comments.js
Just reloading the page helps or inserting js code in the script tag
Maybe someone has already encountered such a problem. Thank you for the answer)

