Hello, I was just wondering if it was good pratice to have a load of javascript functions in a view file, or whether these javascript functions should be put in a javascript file and loaded in. Thanks for your time. -- 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 -~----------~----~----~----~------~----~------~--~---
Gregory Seidman
2007-Mar-01 18:36 UTC
Re: Good practice to include javascript functions in view?
On Thu, Mar 01, 2007 at 03:39:22PM +0100, James Smith wrote:> I was just wondering if it was good pratice to have a load of javascript > functions in a view file, or whether these javascript functions should > be put in a javascript file and loaded in.Static assets should be served as static assets. It makes sense to have a script tag (e.g. javascript_tag) in your views, and maybe an occasional and very small script tag with inline code that uses functions/objects in your static JS files. If you find yourself writing more than three or so lines of JS in a view, you should probably pull it out into a static JS file.> Thanks for your time.--Greg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---