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('<div id="notice_ajax"><%= escape_javascript
(flash.delete(:notice)) %></div>').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,

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.