Forum: Ruby on Rails Class variables in models

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
05748a61a1b05130ec508434301aecf1?d=identicon&s=25 Lee (Guest)
on 2007-02-23 13:22
(Received via mailing list)
I am trying to do the following:

- initialise a class variable for a model class (@@sub_types = [])
- store an array of values into this class variable during the initial
load of a "model"  class
- use this class variable and the populated array within a class
method in the same model when servicing subsequent HTTP requests to my

My tests show that the class variable is initialised/populated when
the model class is first loaded (triggered by a model method call in
class ApplicationController) BUT does not persist for use when
processing requests.

fyi, I have configured development.rb to cache classes.

Why is the class variable not persisting across requests?

This topic is locked and can not be replied to.