Javascript_include within single views

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 element of my site layout file, but
when I try and include a javascript file for a specific view within a
new element in that view it does not work. I guess my question
is: is it okay to create separate elements for specific views?
Will all the code get rendered that is within these new
elements and the elements in my layout file? or will there be
a conflict?

On Thu, Dec 11, 2008 at 6:40 PM, David [email protected] wrote:

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 element of my site layout file, but
when I try and include a javascript file for a specific view within a
new element in that view it does not work. I guess my question
is: is it okay to create separate elements for specific views?
Will all the code get rendered that is within these new
elements and the 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.

David wrote:

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.

Please study this tutorail