Edit: a year later if I was going to do this again I\'d do it with curl.js instead of Rails asset pipeline.
Related: Best way to add page specific javascript in a Rails
Rather than only including the file on one page, you might want to just use logic that's conditional on the page markup. See my answer to a related question. That way, your users don't have to make an additional request for the particular page.
If there's a lot of logic specific to that page (say, 10K+ minified), then yes, split it out. As you suggested in the edit to your question: Rather than doing require_tree .
at the root of your javascripts
directory, instead create a sub-directory called global
and change the top of application.js
from
require_tree .
to
require_tree global
Then put your page-specific CoffeeScript file in the root javascripts
directory, and point to it with a javascript_include_tag
call in that page's template.