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, > bogumbikerBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.
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.> > > > Any suggestion?? > > Check to make sure that the argument contains what it''s supposed to. > > > > > Thanks, > >bogumbiker > > Best, > -- > Marnen Laibow-Koserhttp://www.marnen.org > mar...-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > -- > Posted viahttp://www.ruby-forum.com/.
Seemingly Similar Threads
- Rails - escape_javascript without all the \n\n\n\n\n
- Problem with escape_javascript in 3.0.9rc1
- how to access ActionView::Helpers::JavaScriptHelper::escape_javascript in a model (a newbie question)
- Finding HTML attributes with jQuery in Rails 3.1
- how to use link_to with :remote=>true in rails 3.2.1