Module: ActiveRecord::Calculations

Defined in:
lib/active_record/connection_adapters/advantage_adapter.rb

Overview

copied and modified from "relation/calculations.rb"

Instance Method Summary collapse

Instance Method Details

#count(column_name = nil) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/active_record/connection_adapters/advantage_adapter.rb', line 58

def count(column_name = nil)
  if block_given?
    unless column_name.nil?
      raise ArgumentError, "Column name argument is not supported when a block is passed."
    end
    super()
  elsif column_name.nil?
    # ADS doesn't like counting multiple columns, so if there is no column, force the primary_key
    calculate(:count, self.primary_key)
  else
    calculate(:count, column_name)
  end
end