My Rails 3.1.rc4 app was working fine, but I'm trying to figure out the appropriate way to store my js files in the pipeline. If I put any code in a file other than application.js, I get the following error:
Started GET "/assets/application.js" for 127.0.0.1 at 2011-07-21 23:15:02 -0500 Compiled ~/Dropbox/Rails/myapp/app/assets/javascripts/application.js.coffee (224ms) (pid 69397) Error compiling asset application.js: ExecJS::ProgramError: SyntaxError: Reserved word "function" on line 1 (in /Users/micahalcorn/Dropbox/Rails/myapp/app/assets/javascripts/users/registrations.js.coffee) Served asset /application.js - 500 Internal Server Error
This happens regardless of which file (registrations
in this case) and claims a 'reserved word' regardless of the first word in the file (var
, function
, etc). I am using node.js as my runtime environment, and everything works fine if I remove coffeescript compiling gems and treat it like a Rails 3.0 app. I want to better understand the asset pipeline and follow conventions. Thanks for any suggestions!