Arosboro
Arosboro

Reputation: 1045

What's wrong with this simple coffeescript?

$('#<%= dom_id(@response[:domain]) > div.queries > #<%= dom_id(@response[:tag]) %>').fadeOut ->
  $(this).remove()

It produces the following error in the logs:

ActionView::Template::Error (compile error
app/views/domains/untag.js.coffee:2: syntax error, unexpected $undefined
  $(this).remove()
   ^
app/views/domains/untag.js.coffee:3: unterminated string meets end of file
app/views/domains/untag.js.coffee:3: syntax error, unexpected $end, expecting kEND):
    1: $('#<%= dom_id(@response[:domain]) > div.queries > #<%= dom_id(@response[:tag]) %>').fadeOut ->
    2:  $(this).remove()
  app/views/domains/untag.js.coffee:3:in `compile'
  app/controllers/domains_controller.rb:45:in `untag'

Upvotes: 0

Views: 335

Answers (2)

Helmut Granda
Helmut Granda

Reputation: 4665

Weird, it compiles for me. What settings are you using to compile?

CoffeeScript Test Reference Link

Upvotes: 0

Sergio Tulentsev
Sergio Tulentsev

Reputation: 230276

The problem (at least, one of them) is in your string

'#<%= dom_id(@response[:domain]) > div.queries > #<%= dom_id(@response[:tag]) %>'

You open two <%= blocks, but close only one.

Upvotes: 3

Related Questions