class ActiveRecord::Postgres::Constraints::Railtie

Constants

AR_CAS

Public Instance Methods

apply_patch!() click to toggle source
# File lib/active_record/postgres/constraints/railtie.rb, line 17
def apply_patch!
  Rails.logger.info do
    'Applying Postgres Constraints patches to ActiveRecord'
  end
  AR_CAS::TableDefinition.include TableDefinition
  AR_CAS::PostgreSQLAdapter.include PostgreSQLAdapter
  AR_CAS::AbstractAdapter::SchemaCreation.prepend SchemaCreation

  ::ActiveRecord::Migration::CommandRecorder.include CommandRecorder
  ::ActiveRecord::SchemaDumper.prepend SchemaDumper
end
pg?() click to toggle source
# File lib/active_record/postgres/constraints/railtie.rb, line 29
def pg?
  config = ActiveRecord::Base.connection_config
  return true if config && config[:adapter].in?(%w[postgresql postgis])

  Rails.logger.warn do
    'Not applying Postgres Constraints patches to ActiveRecord ' \
      'since the database is not postgres'
  end
  false
end