Reynard
2008-Jun-03 16:17 UTC
putting require on environment.rb vs on model/controller file
I''m just curious to know is there any benefit in putting require in environment.rb vs in model/controller file? I guess it''s always better to use it in environment.rb, even when only one controller requires it, since once it''s loaded it''s always there anyway. Am I right on this? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ar Chron
2008-Jun-03 20:27 UTC
Re: putting require on environment.rb vs on model/controller
Reynard wrote:> I''m just curious to know is there any benefit in putting require in > environment.rb vs in model/controller file? I guess it''s always better > to use it in environment.rb, even when only one controller requires > it, since once it''s loaded it''s always there anyway. Am I right on > this?I''d opt the other direction... if only one controller requires whatever, that controller should say so. When I see something in environment.rb, I expect to see wide-spread usage in the application. Seeing "require ''will_paginate''" in environment.rb makes sense, as all our controllers paginate. Seeing "require ''pdf/writer'' and require ''pdf/simpletable'' in just a few controllers shows that only those controllers deal with requests for generating PDF files. -- 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 -~----------~----~----~----~------~----~------~--~---