When you call javascript_include_tag :defaults you usually get: prototype.js, effects.js, dragdrop.js, and controls.js.
These are stored in a constant in ActionView::Helpers::AssetTagHelper called 'JAVASCRIPT_DEFAULT_SOURCES`. My application uses jQuery, so I want to replace the Prototype references with something more useful.
I added an initializer with these lines, based on the source code from jRails:
ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = %w{ jquery-1.4.min jquery-ui jquery.cookie }
ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
But when I do this, I get: warning: already initialized constant JAVASCRIPT_DEFAULT_SOURCES during startup.
What's the correct way of changing this value? In the source code it checks for the constant before setting it, but apparently that happens before it runs the initializer scripts.
The Rails 3.0 release will provide much greater flexibility with choice of JS libraries, so I guess this is a problem with an expiration date.