class Dbee::BASE_CLASS_CONSTANT
Instead of using the configuration-first approach, you could use this super class for Model
declaration.
Constants
- BASE_CLASS_CONSTANT
Instead of using the configuration-first approach, you could use this super class for
Model
declaration.
Public Class Methods
inflected_class_name()
click to toggle source
# File lib/dbee/base.rb, line 47 def inflected_class_name inflector.underscore(inflector.demodulize(name)) end
inherited_associations()
click to toggle source
# File lib/dbee/base.rb, line 35 def inherited_associations reversed_subclasses(BASE_CLASS_CONSTANT).each_with_object({}) do |subclass, memo| memo.merge!(subclass.associations_by_name) end.values end
inherited_partitioners()
click to toggle source
# File lib/dbee/base.rb, line 41 def inherited_partitioners reversed_subclasses(BASE_CLASS_CONSTANT).inject([]) do |memo, subclass| memo + subclass.partitioners end end
inherited_table_name()
click to toggle source
# File lib/dbee/base.rb, line 30 def inherited_table_name subclasses(BASE_CLASS_CONSTANT).find(&:table_name?)&.table_name || inflected_table_name(reversed_subclasses(BASE_CLASS_CONSTANT).first.name) end
to_schema(key_chain)
click to toggle source
Returns the smallest needed Dbee::Schema
for the provided key_chain.
# File lib/dbee/base.rb, line 26 def to_schema(key_chain) DslSchemaBuilder.new(self, key_chain).to_schema end
Private Class Methods
inflected_table_name(name)
click to toggle source
# File lib/dbee/base.rb, line 53 def inflected_table_name(name) inflector.pluralize(inflector.underscore(inflector.demodulize(name))) end