Method: Modis::Persistence::ClassMethods#bootstrap_sti

Defined in:
lib/modis/persistence.rb

#bootstrap_sti(parent, child) ⇒ Object

:nodoc:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/modis/persistence.rb', line 17

def bootstrap_sti(parent, child)
  child.instance_eval do
    parent.instance_eval do
      class << self
        attr_accessor :sti_base, :sti_parent
      end
      attribute :type, :string unless attributes.key?('type')
    end

    @sti_child = true
    @sti_parent = parent
    @sti_base = parent.sti_base || parent

    bootstrap_attributes(parent)
    bootstrap_indexes(parent)
  end
end