module Expenses class TotalQuery def call ActiveRecord::Base.connection.execute(query).first end private def query <<~SQL SELECT count(amount) as fixed, 0 as fixed_count, 0 as variable, 0 as variable_count, 0 as total, 0 as total_count, 0 as max_projected, 0 as per_person FROM EXPENSES LIMIT 1; SQL end end end