Sha256: fb3442b9248d14921d42def7adf27d5768b506da28bc9cbea1d7037cdb05229a

Contents?: true

Size: 575 Bytes

Versions: 6

Compression:

Stored size: 575 Bytes

Contents

module Octopus::HasAndBelongsToManyAssociation
  def self.included(base)
    base.instance_eval do
      alias_method_chain :insert_record, :octopus
    end
  end

  def insert_record_with_octopus(record, force = true, validate = true)
    if should_wrap_the_connection?
      Octopus.using(@owner.current_shard) { insert_record_without_octopus(record, force, validate) }
    else
      insert_record_without_octopus(record, force, validate)
    end
  end
end

ActiveRecord::Associations::HasAndBelongsToManyAssociation.send(:include, Octopus::HasAndBelongsToManyAssociation)

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ar-octopus-0.8.1 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.8.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.7.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.6.1 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.6.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.5.0 lib/octopus/has_and_belongs_to_many_association.rb