Sha256: 253c941defdd8f2e5ac79a5fbfac50e6cd235f89bc8d2098dfbdb9a0853a4636

Contents?: true

Size: 679 Bytes

Versions: 5

Compression:

Stored size: 679 Bytes

Contents

module ActiveRecord::Turntable
  class SeqShard < Shard
    def initialize(name = defined?(Rails) ? Rails.env : "development")
      super(nil, name)
    end

    def support_slave?
      false
    end

    private

      def connection_class_instance
        if Connections.const_defined?(name.classify)
          klass = Connections.const_get(name.classify)
        else
          klass = Class.new(ActiveRecord::Base)
          Connections.const_set(name.classify, klass)
          klass.abstract_class = true
          klass.establish_connection ActiveRecord::Base.connection_pool.spec.config[:seq][name].with_indifferent_access
        end
        klass
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-turntable-4.4.1 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-4.4.0 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-4.3.0 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-4.2.0 lib/active_record/turntable/seq_shard.rb
activerecord-turntable-4.1.0 lib/active_record/turntable/seq_shard.rb