Sha256: 4edefed8db2613c74f15c5dd1faca441f4267646204cb3fa711666ea01bb1d9f

Contents?: true

Size: 580 Bytes

Versions: 16

Compression:

Stored size: 580 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

16 entries across 16 versions & 1 rubygems

Version Path
ar-octopus-0.4.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.3.4 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.3.3 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.3.2 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.3.1 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.3.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.2.2 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.2.1 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.2.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.1.2 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.1.1 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.1.0 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.0.30 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.0.29 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.0.28 lib/octopus/has_and_belongs_to_many_association.rb
ar-octopus-0.0.27 lib/octopus/has_and_belongs_to_many_association.rb