Module: HasHierarchy::OrmAdapter

Defined in:
lib/has_hierarchy/orm_adapter.rb,
lib/has_hierarchy/orm_adapter/mongoid.rb,
lib/has_hierarchy/orm_adapter/active_record.rb

Overview

:nocov:

Defined Under Namespace

Modules: ActiveRecord, Mongoid

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/has_hierarchy/orm_adapter.rb', line 16

def self.included(base)
  base.class_eval do
    if defined?(::ActiveRecord) and self < ::ActiveRecord::Base
      require 'has_hierarchy/orm_adapter/active_record'
      include ActiveRecord
    elsif defined?(::Mongoid) and self < ::Mongoid::Document
      require 'has_hierarchy/orm_adapter/mongoid'
      include Mongoid
    end
  end
end