module Sequel::Plugins::ClassTableInheritance::ClassMethods

  1. lib/sequel/plugins/class_table_inheritance.rb


cti_ignore_subclass_columns [R]

An array of columns that may be duplicated in sub-classes. The primary key column is always allowed to be duplicated

cti_instance_dataset [R]

The dataset that table instance datasets are based on. Used for database modifications

cti_models [R]

An array of each model in the inheritance hierarchy that is backed by a new table.

cti_qualify_tables [R]

A boolean indicating whether or not to automatically qualify tables backing subclasses with the same qualifier as their superclass, if the superclass is qualified. Specified with the :qualify_tables option to the plugin and only applied to automatically determined table names (not to the :table_map option).

cti_table_columns [R]

An array of column symbols for the backing database table, giving the columns to update in each backing database table.

cti_table_map [R]

A hash with class name symbol keys and table name symbol values. Specified with the :table_map option to the plugin, and should be used if the implicit naming is incorrect.

cti_tables [R]

An array of table symbols that back this model. The first is table symbol for the base model, and the last is the current model table symbol.

Public Instance methods


The name of the most recently joined table.

[show source]
    # File lib/sequel/plugins/class_table_inheritance.rb
291 def cti_table_name
292   cti_tables.last
293 end

Freeze CTI information when freezing model class.

[show source]
    # File lib/sequel/plugins/class_table_inheritance.rb
269 def freeze
270   @cti_models.freeze
271   @cti_tables.freeze
272   @cti_table_columns.freeze
273   @cti_table_map.freeze
274   @cti_ignore_subclass_columns.freeze
276   super
277 end

The model class for the given key value.

[show source]
    # File lib/sequel/plugins/class_table_inheritance.rb
296 def sti_class_from_key(key)
297   sti_class(sti_model_map[key])
298 end

The table name for the current model class’s main table.

[show source]
    # File lib/sequel/plugins/class_table_inheritance.rb
282 def table_name
283   if cti_tables && cti_tables.length > 1
284     @cti_alias
285   else
286     super
287   end
288 end