Are you allowed to use the javascript_include_tag to include javascript files for specific views? I have included the default javascript files in the <head> element of my site layout file, but when I try and include a javascript file for a specific view within a new <head> element in that view it does not work. I guess my question is: is it okay to create separate <head> elements for specific views? Will all the code get rendered that is within these new <head> elements and the <head> elements in my layout file? or will there be a conflict? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Thu, Dec 11, 2008 at 6:40 PM, David <dlynam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Are you allowed to use the javascript_include_tag to include > javascript files for specific views? I have included the default > javascript files in the <head> element of my site layout file, but > when I try and include a javascript file for a specific view within a > new <head> element in that view it does not work. I guess my question > is: is it okay to create separate <head> elements for specific views? > Will all the code get rendered that is within these new <head> > elements and the <head> elements in my layout file? or will there be > a conflict?Yes, you are allowed to use the javascript_include_tag to include javascript files for specific view templates. Can you post your code so that people can better assist you because I don''t follow your question. -Conrad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
so would the following be redundant then? <% content_for :javascript do %> <%= javascript_tag "new javascript function" %> <% end %> assuming i have <%= yield :javascript %> in my main layout file. On Dec 11, 6:54 pm, "Conrad Taylor" <conra...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Dec 11, 2008 at 6:40 PM, David <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Are you allowed to use the javascript_include_tag to include > > javascript files for specific views? I have included the default > > javascript files in the <head> element of my site layout file, but > > when I try and include a javascript file for a specific view within a > > new <head> element in that view it does not work. I guess my question > > is: is it okay to create separate <head> elements for specific views? > > Will all the code get rendered that is within these new <head> > > elements and the <head> elements in my layout file? or will there be > > a conflict? > > Yes, you are allowed to use the javascript_include_tag to include javascript > files for specific view templates. Can you post your code so that people > can better assist you because I don''t follow your question. > > -Conrad--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David wrote:> so would the following be redundant then? > > <% content_for :javascript do %> > <%= javascript_tag "new javascript function" %> > <% end %> > > assuming i have <%= yield :javascript %> > > in my main layout file.Please study this tutorail http://railscasts.com/episodes/8-layouts-and-content-for -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---