Skip to content

QuinnHarris/sequel-table_inheritance

Repository files navigation

NOT MAINTAINED

The functionality of this plugin was integrated into Sequel 4.24. Use that instead.

Sequel Hybrid Table Inheritance

This is a sequel plugin that combines the functionality of the single and class table inheritance plugins. This plugin uses the single_table_inheritance plugin and should work as a drop in replacement for the class_table_inheritance plugin. This allows using new tables for subclasses only when need for additional columns or possibly referential integrity to exclusively subclassed rows.

Additional features over the class table inheritance plugin

For class table inheritance use this provides additional functionality beyond the standard class_table_inheritance plugin including the following:

  • Eager loading in addition to lazy loading of subclasses.

  • Use RETURNING * on insert if available avoiding a select query after new model saves

  • Features found in the single_table_inheritance not in class_table_inheritance Notably the key_map, key_chooser options and accepting a proc in addition to a hash for model_map option

Using sequel-table_inheritance

Include the sequel-hybrid_table gem in your Gemfile

gem "sequel-table_inheritance"

run “bundle install” if needed

The hybrid_table_inheritance plugin should now work like any other sequel plugin. You should be able to use in place of the class_table_inheritance plugin.

Full documentation available at www.rubydoc.info/gems/sequel-table_inheritance/Sequel/Plugins/HybridTableInheritance