Displaying 1 result from an estimated 1 matches for "ajtestcontroller".
2006 Jan 23
5
Variable Scoping Problem
I am having some problems with variable scoping.
I need to be able to set a variable that is accessable by other methods
within the class (or instance) (i.e not global).
An example is 2 pages that change a class variable:
class AjtestController < ApplicationController
def initialize
@@variable = "init"
end
def show
@display = @@variable
@@variable = "change 1"
end
def list
@display2 = @@variable
@@variable = "change 2"
end
end
When I view ''show'' the page prints "i...