39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/active_record_composition.rb', line 39
def self.included(base)
base.extend(ClassMethods)
base.active_composite = self.create_class("#{base.name}ActiveComposite", ActiveRecord::Base) do
def is_a?(compared)
return true if self.class.name.gsub('ActiveComposite','') == compared.name
return true if compared.name == 'ActiveRecord::Base'
return true if self.class.name == compared.name
return false
end
end
base.active_composite.table_name = "#{base.name}s".underscore
end
|