I am making a long-overdue upgrade from Rails 3.0.20 to Rails 3.1.10. (Later I'll upgrade to 3.2, but I want to get the more major changes in 3.1 working with my codebase first. I don't have a test suite, so please bear with me as I overcome quite a bit of technical debt. Thankfully, the app isn't that large or complex.)
I've always had separate JS files for the various views in my app. Now, Asset Pipeline wants to combine all of those into one file. Problem is, a lot of my variables and function names collide and generally just cause problems.
My assumption is that I need to use some kind of namespacing here, and then initialize the code in a particular namespace on the page that needs it.
Is there a standard way to do this? Or, is there a better way overall?
One note of clarification: I'm not ready to switch to CoffeeScript yet.