As Rahul already mentioned, application.js is precompiled and the same for every action.
So it does not depend on a particular controller. Application.js should contain the javascript you need for all (or most) of your actions.
However, you may expand your application layout with nested layouts. Let us assume the following structure:
... app/view/layouts/application.html.erb ...
<html>
<head>
<%= javascript_include_tag 'application' %>
<%= yield :javascripts %>
<%= stylesheet_link_tag 'application' %>
<%= yield :stylesheets %>
</head>
<body>
<%= yield %>
</body>
</html>
and a:
... app/view/layouts/products.html.erb ...
<% content_for :stylesheets do %>
<%= stylesheet_include_tag 'products' %>
<% end %>
<% content_for :javascripts do %>
<%= javascript_include_tag 'products' %>
<% end %>
<%= render :template => 'layouts/application' %>
So you just have to add/require your stylesheets and javascripts in the products-files.
Notice, all code here should be read as pseudo-code, I did not test it.
Information taken from the "official" Render-Guide.
` tag if you want to be a good citizen.
– Dmytrii Nagirniak Sep 06 '11 at 05:39