Sha256: 9ba08364db1ee4a3adb74cc2afb6ed9ba5c950721aa2a5d827e7f351262b3abc

Contents?: true

Size: 755 Bytes

Versions: 1

Compression:

Stored size: 755 Bytes

Contents

module ActiveRecord
  module Reflection
    class AssociationReflection < MacroReflection
      def table_name
        klass.switch_connection_to(klass.db_charmer_allocated_shard_connection[:config]) if sharded_reflection?
        @table_name = klass.table_name
      end

      def quoted_table_name
        klass.switch_connection_to(klass.db_charmer_allocated_shard_connection[:config]) if sharded_reflection?
        @quoted_table_name = klass.quoted_table_name
      end

      def sharded_reflection?
        # TODO: put this logic in WF
        if klass.db_charmer_allocated_shard_connection && klass.respond_to?(:db_charmer_extended) && klass.db_charmer_extended
          return true;
        end
        return false
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yam-db-charmer-1.7.4.14 lib/db_charmer/active_record/reflection.rb