Module: RailsSQLPrettifier::ARNiceQLConfig

Extended by:
ActiveSupport::Concern
Defined in:
lib/rails_sql_prettifier.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#ar_using_pg_adapter?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
# File 'lib/rails_sql_prettifier.rb', line 57

def ar_using_pg_adapter?
  adapter = ActiveRecord::Base.try(:connection_db_config).try(:adapter) ||
    ActiveRecord::Base.try(:connection_config)&.with_indifferent_access&.dig(:adapter)

  adapter == 'postgresql'
end

#initializeObject



64
65
66
67
68
69
# File 'lib/rails_sql_prettifier.rb', line 64

def initialize
  super
  self.pg_adapter_with_nicesql = false
  self.prettify_active_record_log_output = false
  self.prettify_pg_errors = ar_using_pg_adapter?
end