debian-mirror-gitlab/app/models/concerns/usage_statistics.rb
2020-04-08 14:13:33 +05:30

13 lines
265 B
Ruby

# 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