module ActiveRecord::Calculations::ClassMethods

Public Instance Methods

calculate_with_fakearel(operation, column_name, options = {}) click to toggle source

fix calculations to consider scoped :group

# File lib/fake_arel/calculations.rb, line 5
def calculate_with_fakearel(operation, column_name, options = {})
  cur_scope = scope(:find)
  if !options[:group] && cur_scope && cur_scope[:group]
    options = options.reverse_merge(cur_scope.slice(:group, :having))
  end
  calculate_without_fakearel(operation, column_name, options)
end