techorb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-May-30 17:04 UTC
problems with render :update in controller on winXP
1.8.6, Rails 2.0.2 on winxp. using webrick. When I attempt to render RJS inline in the controller using render :update, it fails horribly. none of the prototype helpers work; each spits out the generated javascript to the screen. If i call the same prototype function in a script tag in the view, sans RJS, it works perfectly. I''ve ran rake to update the js and verified the versions by hand, and starting now to trace this back through the rails source. The only output to the client is the javascript; it even has the correct content type in the headers. could this be a bug somehow with the windows one-click packages? i didn''t have any issues on my mac with 1.8.6 and 2.0.2. I know RJS is finicky with syntax errors - this is a very isolated and standard example on a new rails project. none of my RoR 1.2 code imported at all from older projects, which were heavy on inline RJS. Appreciate any insight. #controller class HomeController < ApplicationController def index render :update do |page| page.insert_html :top, ''test'' , "<li>this list</li>" end end #view <div id="test"> </div> #layout <html> <head> <%= stylesheet_link_tag ''home'' %> <%= javascript_include_tag :defaults %> </head> <body> <%= yield :layout %> </body> </html> ---------------------------------------------------------------- cheers -isaac --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-May-31 17:53 UTC
Re: problems with render :update in controller on winXP
On 30 May 2008, at 18:04, techorb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > 1.8.6, Rails 2.0.2 on winxp. using webrick. > > When I attempt to render RJS inline in the controller using > render :update, it fails horribly. none of the prototype helpers > work; each spits out the generated javascript to the screen. If i > call the same prototype function in a script tag in the view, sans > RJS, it works perfectly. I''ve ran rake to update the js and verified > the versions by hand, and starting now to trace this back through the > rails source. The only output to the client is the javascript; it > even has the correct content type in the headers. > > could this be a bug somehow with the windows one-click packages? i > didn''t have any issues on my mac with 1.8.6 and 2.0.2. I know RJS is > finicky with syntax errors - this is a very isolated and standard > example on a new rails project. none of my RoR 1.2 code imported at > all from older projects, which were heavy on inline RJS. > Appreciate any insight. >Are you just going to home/index ? In which case it''s normal that the rjs is just dumped in the view - it''s only ever going to be executed if the request was made by link_to_remote, remote_form_for etc... If you want to generate a script tag then use javascript_tag (you can use update_page to generate the actual javascript) Fred> > #controller > class HomeController < ApplicationController > > def index > render :update do |page| > page.insert_html :top, ''test'' , "<li>this list</li>" > end > end > > #view > <div id="test"> > </div> > > #layout > <html> > <head> > <%= stylesheet_link_tag ''home'' %> > <%= javascript_include_tag :defaults %> > </head> > <body> > <%= yield :layout %> > > > </body> > </html> > > ---------------------------------------------------------------- > > > cheers > -isaac > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---