In Rails 3.1, there are two JavaScript templates - the one is
'app/views/**/*.js.erb', the other one is
'app/assets/javascripts/*.js.coffee'. What are these? And how different are these?
In short,
'app/views/**/*.js.erb' is bare jQuery with ERb template, and
'app/assets/javascripts/*.js.coffee' is
CoffeeScript file.
In more detail,
'app/views/**/*.js.erb' is written for the response of Ajax request, both with bare jQuery and with ERb.
'app/assets/javascripts/*.js.coffee' is written for another scripts with
CoffeeScript when the page is loaded. And then,
'app/assets/javascripts/*.js.coffee' is compiled to jQuery by server-side JavaScripts (e.g. node.js).