gitlab-org--gitlab-foss/app/models/concerns/usage_statistics.rb

14 lines
265 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module UsageStatistics
extend ActiveSupport::Concern
class_methods do
def distinct_count_by(column = nil, fallback = -1)
distinct.count(column)
rescue ActiveRecord::StatementInvalid
fallback
end
end
end