Hi, I am using layouts and I have one my controller actions include a javascript tag. Is it possible to get the javascript tag thats part of the controller''s view .rhtml to be put into the head tag instead of the body? Or is it to late and I just have to live with having javascript tags in the body? Thanks in advance. Scott. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I wrote a very simple plugin for this a while ago. You can find it at http://agilewebdevelopment.com/plugins/resource_on_demand On 4/3/07, Scott Walter <scott-APWf0AbNa2kIjDr1QQGPvw@public.gmane.org> wrote:> > > Hi, > > I am using layouts and I have one my controller actions include a > javascript tag. Is it possible to get the javascript tag thats part > of the controller''s view .rhtml to be put into the head tag instead > of the body? Or is it to late and I just have to live with having > javascript tags in the body? > > > Thanks in advance. Scott. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
In your layout: <head> <%= yield :extra_head_content %> </head> ... In your view: <% content_for :extra_head_content do %> <%= javascript_include_tag ''whatever'' %> <% end %> WDYT? Scott Walter-2 wrote:> > > Hi, > > I am using layouts and I have one my controller actions include a > javascript tag. Is it possible to get the javascript tag thats part > of the controller''s view .rhtml to be put into the head tag instead > of the body? Or is it to late and I just have to live with having > javascript tags in the body? > > > Thanks in advance. Scott. > > > > >-- View this message in context: http://www.nabble.com/Is-it-too-late-to-put-stuff-in-the-head--tf3509250.html#a9802865 Sent from the RubyOnRails Users mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Perfect and very elegant! On Apr 2, 2007, at 9:51 PM, s.ross wrote:> > > In your layout: > > <head> > <%= yield :extra_head_content %> > </head> > ... > > In your view: > > <% content_for :extra_head_content do %> > <%= javascript_include_tag ''whatever'' %> > <% end %> > > WDYT? > > > Scott Walter-2 wrote: >> >> >> Hi, >> >> I am using layouts and I have one my controller actions include a >> javascript tag. Is it possible to get the javascript tag thats part >> of the controller''s view .rhtml to be put into the head tag instead >> of the body? Or is it to late and I just have to live with having >> javascript tags in the body? >> >> >> Thanks in advance. Scott. >> >>> >> >> > > -- > View this message in context: http://www.nabble.com/Is-it-too-late- > to-put-stuff-in-the-head--tf3509250.html#a9802865 > Sent from the RubyOnRails Users mailing list archive at Nabble.com. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---