From 7f6455b033a168970ecc59639da9a88ab23a463f Mon Sep 17 00:00:00 2001 From: abMatGit Date: Fri, 21 Apr 2017 19:04:55 -0700 Subject: [PATCH] add establish connection to the alias hijacking --- lib/octopus/model.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/octopus/model.rb b/lib/octopus/model.rb index eb748e42..f6031509 100644 --- a/lib/octopus/model.rb +++ b/lib/octopus/model.rb @@ -109,6 +109,9 @@ class << self alias_method :connected_without_octopus?, :connected? alias_method :connected?, :connected_with_octopus? + alias_method :establish_connection_without_octopus, :establish_connection + alias_method :establish_connection, :establish_connection_with_octopus + def table_name=(value = nil) self.custom_octopus_table_name = true super @@ -184,9 +187,9 @@ def set_table_name_with_octopus(value = nil, &block) set_table_name_without_octopus(value, &block) end - def octopus_establish_connection(spec = ENV['DATABASE_URL']) + def establish_connection_with_octopus(spec = ENV['DATABASE_URL']) self.custom_octopus_connection = true if spec - establish_connection(spec) + establish_connection_without_octopus(spec) end def octopus_set_table_name(value = nil)