Possible Duplicate:
Using Rails 3.1, where do you put your “page specific” javascript code?
I have a controller called course store and I wish to include an external js file from a third party only on that page. How can I do this?
Possible Duplicate:
Using Rails 3.1, where do you put your “page specific” javascript code?
I have a controller called course store and I wish to include an external js file from a third party only on that page. How can I do this?
Something like this should work...
<%= javascript_include_tag( "http://www.example.com/xmlhr" ) if params[:controller] == 'course_store' %>
You can do with content_for
,
<% content_for :head do %>
<%= javascript_include_tag 'admin' %>
<% end %>
or
<% content_for :head do %>
<script type="text/javascript">
$(function() {
...
...
});
</script>
<% end %>
More : http://apidock.com/rails/ActionView/Helpers/CaptureHelper/content_for