search for: testclassvari

Displaying 1 result from an estimated 1 matches for "testclassvari".

2005 Dec 29
3
Class Variable Scope
(Hopefully) a quick question about variable scope issues. In one of my controllers, I have a class variable: class TestController < ApplicationController @@testClassVariable = 0 ... The problem is, in my "list" method I''m trying to increment this variable by one each time, printing it out, but it seems to reset to 0 every time the list method is called: def list ... @@testClassVariable += 1 logger.info @@testClassVariable #prints "...