Forum: Ruby on Rails Class level variables in Mongrel

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
86d03e22c00011cea78af5e7a26bd9db?d=identicon&s=25 Kris Kohlstedt (kkohlstedt)
on 2007-07-22 20:52
I'm trying to use a class level variable @@count as a counter between
requests to the server.  So for example I initialize it @@count = 0 at
the top of the class and in a method I have @@count = @@count+1.  It
seems though that @@count is begin reinitialized back to 0 each time the
controller is called.  Is there something that I'm missing here?  I'm
running under mongrel on Linux.
E3513c4edd6810bb4b9914b58da2a2c3?d=identicon&s=25 Jamal Soueidan (jamal)
on 2007-07-22 21:05
Kris Kohlstedt wrote:
> I'm trying to use a class level variable @@count as a counter between
> requests to the server.  So for example I initialize it @@count = 0 at
> the top of the class and in a method I have @@count = @@count+1.  It
> seems though that @@count is begin reinitialized back to 0 each time the
> controller is called.  Is there something that I'm missing here?  I'm
> running under mongrel on Linux.

Well for every request to the server you would get a new class variable
:)
This topic is locked and can not be replied to.