Module: ShardedDatabase::Aggregate::ClassMethods

Defined in:
lib/sharded_database/aggregate.rb

Instance Method Summary collapse

Instance Method Details

#find_with_aggregate_proxy(*args) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/sharded_database/aggregate.rb', line 21

def find_with_aggregate_proxy(*args)
  without_aggregate_proxy = args.last.is_a?(Hash) && args.last.delete(:aggregate_proxy).is_a?(FalseClass)
  if without_aggregate_proxy
    temporarily_undef_method(:after_find) { find_without_aggregate_proxy(*args) }
  else
    find_without_aggregate_proxy(*args)
  end
end

#preserve_attributes(*attrs) ⇒ Object



30
31
32
# File 'lib/sharded_database/aggregate.rb', line 30

def preserve_attributes(*attrs)
  @preserved_attributes = attrs.map(&:to_s)
end

#source_class(klass_name) ⇒ Object



34
35
36
37
# File 'lib/sharded_database/aggregate.rb', line 34

def source_class(klass_name)
  @source_class = klass_name
  apply_model_with_connection_to(klass_name)
end