Sha256: 62f8e0fc97ccc24589b798f48bd53dc8731b11aa52a812ffaddb90b1aafff782

Contents?: true

Size: 1.03 KB

Versions: 8

Compression:

Stored size: 1.03 KB

Contents

module DBViewCTI
  module Model
    module Extensions
      extend ActiveSupport::Concern
      
      module ClassMethods
        
        def cti_base_class
          self.class_eval { include(DBViewCTI::Model::CTI) }
          @cti_base_class = true
          cti_redefine_remote_associations
        end
  
        def cti_derived_class
          # there is no need to include DBViewCTI::Model::CTI in derived classes
          # (as we do in cti_base_class), since it is included in the base class
          # and we inherit from that  
          @cti_derived_class = true
          self.table_name = DBViewCTI::Names.view_name(self)
          self.superclass.cti_register_descendants(self.name)
          cti_create_association_proxies
          cti_redefine_remote_associations
          # call redefine_remote_associations on superclass to deal with associations
          # that were defined after the call to cti_derived_class or cti_base_class
          self.superclass.cti_redefine_remote_associations
        end
  
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
dbview_cti-0.2.3 lib/db_view_cti/model/extensions.rb
dbview_cti-0.2.2 lib/db_view_cti/model/extensions.rb
dbview_cti-0.2.1 lib/db_view_cti/model/extensions.rb
dbview_cti-0.2.0 lib/db_view_cti/model/extensions.rb
dbview_cti-0.1.5 lib/db_view_cti/model/extensions.rb
dbview_cti-0.1.4 lib/db_view_cti/model/extensions.rb
dbview_cti-0.1.3 lib/db_view_cti/model/extensions.rb
dbview_cti-0.1.2 lib/db_view_cti/model/extensions.rb