I have some jquery plugins that are required in the header.
For page performance it would be better to have my js at the bottom of the page. Is there a way I can make javascript load in the header of some pages and in the footer of others?
The simple answer is yes, you can place the javascript load code at the base of your template, which helps with some load performance.
Place this line <%= javascript_include_tag "application" %> at the end of the body
I can't think of a good reason to load it in the header for some and the footer for others.
application.jsI'm assuming that the asset-pipeline tag also means "I'm precompiling assets and need to generate something besides application.*"
From: http://guides.rubyonrails.org/asset_pipeline.html
If you have other manifests or individual stylesheets and JavaScript files to include, you can add them to the precompile array in config/application.rb:
config.assets.precompile += ['admin.js', 'admin.css', 'swfObject.js']
A file such as admin.js should not require assets which overlap with other precompiled files which are loaded on a page. So long as that is the case, I believe this will solve the problem you are encountering with trying to have includes in your footer.
You can use:
<%= javascript_include_tag "application" %>
in the bottom of your html structure to load ALL js files in the bottom of your page.
You can also create another js file (jsheader.js, for example) with other requires and do the same thing:
<%= javascript_include_tag "jsheader" %>
and create another file (jsfooter.js, for example), and add it to the bottom:
<%= javascript_include_tag "jsfooter" %>
Now you will have in the header all the scripts that you need, same thing for your footer scripts.