I have this stock rails 3.1 app, before even adding anything, I was testing to see if the assets are working as advertised
so i created this app/assets/javascripts/test.coffee
where test.coffee is just a
alert "hi"
When I navigate to http://127.开发者_JAVA百科0.0.1:3000/assets/test.coffee, I do see
(function() {
alert("hi");
}).call(this);
But if I do http://127.0.0.1:3000/assets/test.js, I get routing error; but I thought this is the correct behavior, not the above one. What have I done wrong?
Try renaming your your js file to test.js.coffee
Coffee extension indicates that this file should be preprocessed with coffee processor, same as:
index.html.haml
is justindex.html
with haml processor orstyle.css.sass
is juststyle.css
with sass processor
精彩评论