Ruby on Rails
HowToWritePluginWithModels (Version #2)

Rails does some sneaky stuff with ActiveRecord models each time it handles a new request.

Make sure your ActiveRecord models in your plugin redefine the reloadable? class method as follows:

def self.reloadable?; false end

This will prevent Rails from castrating your model of all its instance methods and variables. Just be careful you don’t keep stuff in there that’s tied to a request, because it won’t get cleared out.

Rails does some sneaky stuff with ActiveRecord models each time it handles a new request.

Make sure your ActiveRecord models in your plugin redefine the reloadable? class method as follows:

def self.reloadable?; false end

This will prevent Rails from castrating your model of all its instance methods and variables. Just be careful you don’t keep stuff in there that’s tied to a request, because it won’t get cleared out.