Guys, I''m using render :update in a few places in an app we just upgraded from 1.2 to 2.0.2. However, :update seems to be broken in 2.0.2. Consider the following: class TesterController < ApplicationController def test_it render :update do |page| page.alert("This is a test") end end end I then drive this from the console: Loading development environment (Rails 2.0.2)>> require ''action_controller/test_process'' >> require ''application'' >> require ''tester_controller'' >> request = ActionController::TestRequest.new >> response = ActionController::TestResponse.new >> request.env[''REQUEST_METHOD''] = ''GET'' >> request.action = "test_it" >> rs = TesterController.process(request,response) >> rs.body=> "try {\nalert(\"JOHN\");\n} catch (e) { alert(''RJS error:\\n\\n'' + e.toString()); alert(''alert(\\\"This is a test\\\");''); throw e }" Now, in the past, with older Rails versions (1.x), I am almost 100% sure this would''ve looked like:>> rs.body=> "<script language=\"javascript\">try {\nalert(\"JOHN\");\n} catch (e) { alert(''RJS error:\\n\\n'' + e.toString()); alert(''alert(\\\"This is a test\\\");''); throw e }" In other words, the response would be surrounded by: <script language="javascript"> </script> As it is, this breaks a lot of our app. Can someone tell me what I''m missing? Am I wrong? Thanks, John --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
John Wells
2008-May-07 23:11 UTC
Re: render :update doesn''t add proper script tags in 2.0?
On Wed, May 7, 2008 at 3:35 PM, John Wells <lists-y8WhZ5XeQqVfbyii3fMa5/Z4XP/Yx64J@public.gmane.org> wrote:> Guys, > > I''m using render :update in a few places in an app we just upgraded > from 1.2 to 2.0.2. However, :update seems to be broken in 2.0.2. > Consider the following:Ok, so I looked at the headers coming back across, and it appears that the mime type is set properly to indicate Javascript. So now I''m doubting whether a <script/> tag was ever involved. The problem is exhibited by the fact that in_place_editors from scriptaculous used to evaluate this returned code properly as javascript (evalScripts:true), but they no longer work. Could it be that it''s not Rails that has changed, but scriptaculous? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---