Mr_Tibs
2008-May-12 22:45 UTC
class variables refreshed in development, but how exception_notification does it?
Hi, I discovered today that Rails class variables are refreshed in development mode (because classes are reloaded). How else can you persist class variables in memory? I know it is possible, because the exception_notification plugin does it. I don''t think they use session variables, because I dumped the session object and it looked like the info that I was looking for wasn''t there. They also don''t use a database. Thanks, Tiberiu --~--~---------~--~----~------------~-------~--~----~ 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-12 22:50 UTC
Re: class variables refreshed in development, but how exception_notification does it?
On 12 May 2008, at 23:45, Mr_Tibs wrote:> > Hi, > > I discovered today that Rails class variables are refreshed in > development mode (because classes are reloaded). How else can you > persist class variables in memory? I know it is possible, because the > exception_notification plugin does it. > I don''t think they use session variables, because I dumped the session > object and it looked like the info that I was looking for wasn''t > there. They also don''t use a database.If a file is in one of the paths listed in Dependencies.load_once_paths then the classes defined inside aren''t reloaded. By default this includes where plugins are. In general persisting class variables in memory (other than just for caching stuff) isn''t a great idea (because they aren''t shared across mongrels/ fastcgi instances /etc...) Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---