Module: XBar::HasAndBelongsToManyAssociation

Defined in:
lib/xbar/has_and_belongs_to_many_association.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
# File 'lib/xbar/has_and_belongs_to_many_association.rb', line 2

def self.included(base)
  base.instance_eval do
    alias_method_chain :insert_record, :xbar
  end
end

Instance Method Details

#insert_record_with_xbar(record, force = true, validate = true) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/xbar/has_and_belongs_to_many_association.rb', line 8

def insert_record_with_xbar(record, force = true, validate = true)
  if should_wrap_the_connection?
    XBar.using(@owner.current_shard) { insert_record_without_xbar(record, force, validate) }
  else
    insert_record_without_xbar(record, force, validate)
  end
end