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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs