RJS - unterminated string literal

Eduardo Scoz wrote:

Hi guys,

I'm having problems with RJS, and can't figure it out... I'm using RJS to do a very simple effect on a div:

page.visual_effect :blind_up, 'comment-'+@id

The request works, but the javascript it sends to the browser doesn't work:

try {

new Effect.BlindUp("comment-9",{});

} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('new Effect.BlindUp(\"comment-9\",{

});'); throw e }

The new lines inside the code end up causing an "unterminated string literal" error on the browser.. If i remove them manually, it works correctly.

There used to be a bug in the RJS JavaScript debugging code, but it was fixed some time ago. Are you using actionpack-1.13.3?

Alternatively, turn off the debug code by adding

  config.action_view.debug_rjs = false

inside the Rails::Initializer.run block in environment.rb.