3
votes

Prior to rails 3.1, javascript code that was common to the application belonged in application.js by default, and was loaded by javascript_include_tag :defaults

With the asset pipeline in rails 3.1, the application.js file becomes a manifest file, and it appears that code I put in it is not included in the result. Where is this javascript code supposed to be moved to now? Obviously, I could create any other name and make sure that it is included by the manifest, but is there a default location already expected by idiom?

2

2 Answers

1
votes

I encounter the same problem in rails 3.1 rc6. I use javascript_include_tag :application instead

0
votes

Look closer:

the code in application.js is rendered, it's just at the end of the resulting js file.

Example, try:

//= require jquery
//= require jquery_ujs
//= require_tree .
alert('foo');

the alert dialog will appear in all pages.