I just want to have an array as global, so when I add or remove an element, it can be reflected anywhere in the class.
For example:
class something
@@my_array = Array.new
def self.action_1
@@my_array << 1
@@my_array << 2
@@my_array << 3
end
def self.how_many_elements
puts "# of elements: " + @@my_array.size.to_s
end
end
If i do the following:
something.action_1 => from controller_a
something.how_many_elements => from controller b
I always get the following output:
"# of elements: 0"
Why?