I have page1, page2 and page3 in my Rails application.
For page2 I have a special javascript file with some jQuery .click events.
I include the file to my application.js //= require specialfile
The specialfile is in my app/assets/javascripts/specialfile.js path.
I figured out that if I will go from page1 or page3 to the page2, the special js file doesn't work unless I will refresh the page. It works only if I will go directly to the page2 without any previous move.
I tried not to require the specialfile.js in my application.js pipeline and include it directly to my page2 by: <%= javascript_include_tag "specialfile" %>. It didn't work. I also tried to add there the full path like assets/javascript/specialfile.js ... app/assets/javascript/specialfile but no luck.
How can I do it?
I found something like: <%= javascript_include_tag params[:controller] if AppName::Application.assets.find_asset("#{params[:controller]}.js") %> but I don't understand well. How I can point to the specialfile?
view page source, do you seespecialfile.jsfile?turbolinks.