I have a functioning JavaScript program and if I paste the code directly into a Rails view, it works fine. When I place it in assets/javascript and call it with a javascript_include_tag, I start getting syntax errors for every occurrence of a curly bracket. For instance:
var rect = {};
throws an error, while:
var rect = new Object();
does not. Similarly, creating an object like this throws an error:
function tag(x, y, width, height){
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.book = books[0];
}
Anyone know what's going on?