Module: RailsSqlViews::Loader

Defined in:
lib/rails_sql_views/loader.rb

Constant Summary collapse

SUPPORTED_ADAPTERS =
%w( Mysql PostgreSQL SQLServer SQLite )

Class Method Summary collapse

Class Method Details

.load_extensionsObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rails_sql_views/loader.rb', line 6

def self.load_extensions
  SUPPORTED_ADAPTERS.each do |db|
    if ActiveRecord::ConnectionAdapters.const_defined?("#{db}Adapter")
      require "rails_sql_views/connection_adapters/#{db.downcase}_adapter"
      ActiveRecord::ConnectionAdapters.const_get("#{db}Adapter").class_eval do
        include RailsSqlViews::ConnectionAdapters::AbstractAdapter
        include RailsSqlViews::ConnectionAdapters.const_get("#{db}Adapter")
      end
    end
  end
end