ActionView::Template::Error - Unexpected token name #7700

Closed
fabianoalmeida opened this Issue Sep 19, 2012 · 4 comments

Comments

Projects
None yet
3 participants

Hi mate!

I'm having this exception after migrate my application from version 3.0.10 to 3.2.2 and define this config.assets.compile = true in production.rb. However, my page isn't appearing because this error is blocking rails to render it.

I tested remove one javascript file (this) and rails can show my page. But, with this file, the error show:

(Unexpected token name, expected punc (line: 35, col: 23, pos: 774)

In this line and column there is .top(function() y(this.index)) (I'm using Protovis) and I don't know why this error occurs.

This code will call an array (y) passing some index.

I have a lot of javascript files and this problem only appear at this line and column.

Thanks in advance for your help.

Contributor

lest commented Sep 19, 2012

.top(function() y(this.index)) doesn't seem a valid syntax to me. Maybe it should be .top(function() { y(this.index) })?

Member

steveklabnik commented Sep 19, 2012

Yep, I'm pretty sure this is a problem with your JS, not with Rails. Please try what @lest suggested.

OMG! That's it. I deduced that could be a Rails problem because the same code works fine in 3.0.10 version. But, after read your comments, analyzing better my code and the compression configuration for production environment, this makes sense. Rails needs a "correct" code implemented to zip some JS or CSS code. So... Thanks so much @lest and @steveklabnik.

Member

steveklabnik commented Sep 20, 2012

:) Glad to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment