Class: ActiveRecord::Reflection::AssociationReflection

Inherits:
Object
  • Object
show all
Defined in:
lib/hobo/extensions/active_record/associations/reflection.rb

Instance Method Summary collapse

Instance Method Details

#klass_with_create_polymorphic_classObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/hobo/extensions/active_record/associations/reflection.rb', line 7

def klass_with_create_polymorphic_class
  if options[:polymorphic]
    begin
      klass_without_create_polymorphic_class
    rescue NameError => e
      Object.class_eval "class #{e.missing_name} < ActiveRecord::Base; self.table_name =  '#{active_record.name.tableize}'; def self.hobo_shim?; true; end; end"
      e.missing_name.constantize
    end
  else
    klass_without_create_polymorphic_class
  end
end