Sha256: 683d1bc7e31c3020a8c874d2340a234bc57cf9fd8f47da012f27fd5a7f0e8289

Contents?: true

Size: 857 Bytes

Versions: 25

Compression:

Stored size: 857 Bytes

Contents

module ActiveRecord::Turntable::ActiveRecordExt
  module Sequencer
    extend ActiveSupport::Concern

    included do
      include DatabaseStatements
      alias_method_chain :prefetch_primary_key?, :turntable
    end

    module DatabaseStatements
      def default_sequence_name(table_name, pk = nil)
        ActiveRecord::Turntable::Sequencer.sequence_name(table_name, pk)
      end
    end

    def prefetch_primary_key_with_turntable?(table_name = nil)
      ActiveRecord::Turntable::Sequencer.has_sequencer?(table_name)
    end

    def next_sequence_value(sequence_name)
      ActiveRecord::Turntable::Sequencer.sequences[sequence_name].next_sequence_value(sequence_name)
    end

    def current_sequence_value(sequence_name)
      ActiveRecord::Turntable::Sequencer.sequences[sequence_name].current_sequence_value(sequence_name)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
activerecord-turntable-2.3.2 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.3.1 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.3.0 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.2.2 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.2.1 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.2.0 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.1.1 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.1.0 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.1.0.rc2 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.1.0.rc1 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.1.0.beta2 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.1.0.beta1 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.6 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.5 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.4 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.3 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.2 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.1 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.0 lib/active_record/turntable/active_record_ext/sequencer.rb
activerecord-turntable-2.0.0.rc1 lib/active_record/turntable/active_record_ext/sequencer.rb