modifying JAVASCRIPT_DEFAULT_SOURCES

Hi, you can define the following in your environment.rb

JAVASCRIPT_DEFAULT_SOURCES = [ ‘prototype’, ‘my_js_file1’, ‘my_js_file2’, … ]

For further information, you can check the following site:


http://caboo.se/doc/classes/ActionView/Helpers/AssetTagHelper.html

Good luck,

-Conrad

cheers, mate. that's what I was looking for.

actually, that doesn't work.

# environment.rb
JAVASCRIPT_DEFAULT_SOURCES = ['foo', 'bar']

# nor does this
ActionView::Helpers::AssetTagHelper.const_set(:JAVASCRIPT_DEFAULT_SOURCES,
['foo', 'bar'])

damn. I can't believe it's this difficult to change the default js
includes.

I created a ticket a while back to allow you to easily add to :defaults, or create your own symbols that expand to multiple sources. If this looks like something that would be useful to you, check it out and add a +1 to the ticket.

http://dev.rubyonrails.org/ticket/10350

something that would be useful to you, check it out and add a +1 to the
ticket.

done. as a quickie, I defined my own method for
ActionView::Helpers::AssetTagHelper #set_javascript_defaults

# environment.rb
ActionView::Helpers::AssetTagHelper.set_javascript_defaults(['foo',
'bar'])

however, now I want different resources based upon RAILS_ENV (ie: for
production, I want to include minified resources. I use a custom js
builder to build my resources).

I expected I could simply place the above line into development.rb but I
get an error:

"config/environments/development.rb:24:in `load_environment': undefined
method `set_javascript_defaults' for
ActionView::Helpers::AssetTagHelper:Module (NoMethodError)"