Module: NeetoCommonsBackend::Initializers::EnableExtensionHerokuMonkeypatch

Defined in:
lib/neeto_commons_backend/initializers/_enable_extension_hack.rb

Defined Under Namespace

Modules: InstanceMethods

Class Method Summary collapse

Class Method Details

.apply_patch!Object



10
11
12
13
14
15
16
# File 'lib/neeto_commons_backend/initializers/_enable_extension_hack.rb', line 10

def self.apply_patch!
  if defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
    patched_method = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.instance_method(:enable_extension)
    # Only patch this method if it's method signature matches what we're expecting
    ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend InstanceMethods if patched_method&.arity == 1
  end
end