Module: Switchman::ActiveRecord::Base::ClassMethods

Defined in:
lib/switchman/active_record/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#shard_categoryObject



8
9
10
# File 'lib/switchman/active_record/base.rb', line 8

def shard_category
  @shard_category || :default
end

Instance Method Details

#integral_id?Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/switchman/active_record/base.rb', line 25

def integral_id?
  if @integral_id == nil
    @integral_id = columns_hash[primary_key].type == :integer
  end
  @integral_id
end

#transaction(*args, &block) ⇒ Object



32
33
34
35
36
37
# File 'lib/switchman/active_record/base.rb', line 32

def transaction(*args, &block)
  return super if !block || !current_scope
  super(*args) do
    current_scope.activate(&block)
  end
end