Sha256: 02ad42a9235b5429563b061ef885eeea7fa9cce9a171a6f5a455a6b2c7058b68

Contents?: true

Size: 885 Bytes

Versions: 6

Compression:

Stored size: 885 Bytes

Contents

module PgComment
  class Engine < Rails::Engine
    initializer 'pg_comment.load_adapter' do
      ActiveSupport.on_load :active_record do
        ActiveRecord::ConnectionAdapters.module_eval do
          include PgComment::ConnectionAdapters::SchemaStatements
          include PgComment::ConnectionAdapters::SchemaDefinitions
        end

        ActiveRecord::SchemaDumper.class_eval do
          include PgComment::SchemaDumper
        end

        if defined?(ActiveRecord::Migration::CommandRecorder)
          ActiveRecord::Migration::CommandRecorder.class_eval do
            include PgComment::Migration::CommandRecorder
          end
        end

        conf_name = ActiveRecord::Base.connection_pool.spec.config[:adapter]
        if conf_name == 'postgresql' then
          require 'pg_comment/connection_adapters/postgresql_adapter'
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pg_comment-0.2.1 lib/pg_comment/engine.rb
pg_comment-0.2.0 lib/pg_comment/engine.rb
pg_comment-0.1.2 lib/pg_comment/engine.rb
pg_comment-0.1.1 lib/pg_comment/engine.rb
pg_comment-0.1.0 lib/pg_comment/engine.rb
pg_comment-0.0.5 lib/pg_comment/engine.rb