lib/connection_manager/using.rb in connection_manager-0.3.7 vs lib/connection_manager/using.rb in connection_manager-0.3.8

- old
+ new

@@ -22,31 +22,26 @@ end end def build_dup_class(connection_class_name) con_class = connection_class_name.constantize + db_name = con_class.database_name dup_klass = dup dup_klass.class_eval <<-STR - self.table_name = '#{table_name_for_dup(con_class)}' + self.database_name = '#{db_name}' + self.table_name_prefix = '#{db_name}.' + self.table_name = '#{db_name}.#{table_name.split('.').last}' class << self def model_name - '#{self.name}'.constantize.model_name + #{self.name}.model_name end end STR extend_dup_class(dup_klass,connection_class_name) self.const_set("#{connection_class_name}Dup", dup_klass) end - - def table_name_for_dup(con_class) - "#{table_name_prefix_for_dup(con_class)}#{table_name.split('.').last}" - end - - def table_name_prefix_for_dup(con_class) - con_class.abstract_class? ? table_name_prefix : con_class.table_name_prefix - end # Extend the connection override module from the connetion to the supplied class def extend_dup_class(dup_class,connection_class_name) begin mod = "#{connection_class_name}::ConnectionOverrideMod".constantize @@ -61,10 +56,10 @@ # to override the connection and superclass def build_connection_override_module(connection_class_name) connection_class_name.constantize.class_eval <<-STR module ConnectionOverrideMod def connection_class - "#{connection_class_name}".constantize + #{connection_class_name} end def connection connection_class.connection end