Are you allowed to use the javascript_include_tag to include javascript files for specific views? I have included the default javascript files in the <head> element of my site layout file, but when I try and include a javascript file for a specific view within a new <head> element in that view it does not work. I guess my question is: is it okay to create separate <head> elements for specific views? Will all the code get rendered that is within these new <head> elements and the <head> elements in my layout file? or will there be a conflict?
Yes, you are allowed to use the javascript_include_tag to include javascript
files for specific view templates. Can you post your code so that people
can better assist you because I don’t follow your question.
-Conrad
so would the following be redundant then?
<% content_for :javascript do %> <%= javascript_tag "new javascript function" %> <% end %>
assuming i have <%= yield :javascript %>
in my main layout file.