Module: Archivist::Base::DB

Defined in:
lib/archivist/base/db.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, MySQL, PostgreSQL

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/archivist/base/db.rb', line 5

def self.included(base)
  base.send(:extend, ClassMethods)
  base.send(:include, InstanceMethods)
  connection_class = base.connection.class.to_s.downcase

  if connection_class.include?("mysql")
    base.send(:extend, MySQL)
  elsif connection_class.include?("postgresql")
    base.send(:extend, PostgreSQL)
  else
    raise "DB type not supported by Archivist!"
  end
end