Module: ActsAsArchive::Base::Table

Defined in:
lib/acts_as_archive/base/table.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



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

def self.included(base)
  unless base.included_modules.include?(InstanceMethods)
    base.send :extend, ClassMethods
    base.send :include, InstanceMethods

    if base.connection.class.to_s.include?('Mysql')
      base.send :extend, ActsAsArchive::Base::Adapters::MySQL
    elsif base.connection.class.to_s.include?('PostgreSQL')
      base.send :extend, ActsAsArchive::Base::Adapters::PostgreSQL
    else
      raise 'acts_as_archive does not support this database adapter'
    end
  end
end