When does Rails remove 'association' methods?

My tests indicate that, when running in development mode, Rails removes
‘association’ methods (e.g. a method created for has_many) after the
processing of a request completes. I assume they are removed from the
class object for the given instance object.

For example, my code is as follows:

class Picklist < ActiveRecord::Base

has_many :list_items


class ListItems < ActiveRecord::Base

belongs_to :picklist


I also have a singleton factory class called ‘PicklistFactory’ which
allows me to:


This returns me an object of class Picklist.

The idea is that the factory object is created once only and will
return Picklist objects on-demand. The create method checks if an
object exists and if so returns it, otherwise creates an object
containing all available Picklist objects in the database.

I observe that the factory object and its referenced Picklist objects
‘stay around’ between HTTP requests but the association method
list_items is not available for subsequent requests and throws an
method_missing error.

I’d like to understand why the association method disappears and
whether this would be the case in production (require-mode).

Any pointers/thoughts appreciated.