Escape_javascript error

Hello,
I am using jQuery for all ajax stuff and recently got following error:

ActionView::TemplateError (private method `gsub’ called for #<Array:
0x2425ae8>) on line #1 of…

and the code where it happens:

$("#notice_ajax").before(’

<%= escape_javascript
(flash.delete(:notice)) %>
’).remove();

when I remove ‘escape_javascript’ then everything works fine.

It seems that ‘gsub’ thinks that its argument (flash.delete(:notice))
is an array…??

Any suggestion??

Thanks,
bogumbiker

bgumbiker wrote:
[…]

It seems that ‘gsub’ thinks that its argument (flash.delete(:notice))
is an array…??

And is it?

Any suggestion??

Check to make sure that the argument contains what it’s supposed to.

Thanks,
bogumbiker

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Sep 4, 11:24 am, Marnen Laibow-Koser <rails-mailing-l…@andreas-
s.net> wrote:

bgumbiker wrote:

[…]

It seems that ‘gsub’ thinks that its argument (flash.delete(:notice))
is an array…??

And is it?

No it is a string. As in my initial post if I remove escape_javascript
then the code works fine.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs