javascript - Load custom JS files in specific view -


I have a view that a diagram tool has been implemented using kineticj in Janet and I can only upload JS files I want to load in specific I have done this:

In this view:

  & lt;% content_for: head do% & gt; & Lt;% = javascript_include_tag "Image"% & gt; & Lt;% end% & gt;  

Draw JS file whose name is diagrams.js:

  // requires diagramtool / kinetic // is required diagramtool / diagramtool0 // requirement Diagramtool / Diagramtool1 // / diagramtool2 requires  

application. Js file (requires_tree has been removed):

  // requirement = jquery // = bootstrap is required -sprockets // requires jquery // Required jquery_ujs // Requires TurboLux  

layout, application.html.erb:

  & lt;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Realyzor & lt; / Title & gt; & Lt;% = stylesheet_link_tag 'app', media: 'all', 'data-turbo-lines-track' = & gt; True% & gt; & Lt;% = javascript_include_tag 'application', 'data-turbo-lines-track' = & gt; True% & gt; & Lt;% = yield (: head)% & gt; & Lt;% = csrf_meta_tags% & gt; & Lt; / Head & gt;  

and added this line to config / initializers / assets.rb:

  Rails.application.config.assets.precompile + =% w ( Picture.js)  

And my problem is that, to load the files, I have to go to the view and refresh the page.

Go to see why I have to do it and then refresh the page to load JS files?

When I go to the scene, why not load the JS files?

I am using Rail 4.1.5


Comments