You can now skip class reloading in model classes referenced by
has_many_polymorphs in development mode.
Normally if you modify a model, Rails will unload and reload the file. This means the parent model has to build the polymorphic relationship all over again, which can be slow. But if the child classes aren’t unloaded in the first place, we avoid this problem. Of course while you are working on the models themselves you need to switch the caching off.
config.after_initialize do config.has_many_polymorphs_cache_classes = true end
The instructions in this section are unnecessary as of version 27.1 of the plugin.
Also at the top of
app/controllers/application.rb, you need:
This makes sure the parent model is always loaded at least once. Note that STI parent classes will also get ejected from the reloadable lists, since they need to be kept around for their children to function.
If you are working in the console or migrations and need to access the methods added by the plugin, you still need to manually reference your polymorphic parent class.
The usual place. Rails 1.2.0 or later is required for the new features.