Created
October 24, 2013 10:08
-
-
Save fofr/7134516 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :errors, -> { where(http_status: 404) } | |
scope :archives, -> { where(http_status: 410) } | |
scope :redirects, -> { where(http_status: 301) } | |
scope :other, -> { where('http_status NOT IN (?)', [404, 410, 301]) } | |
def self.aggregated | |
scoped.select('hits.path, sum(hits.count) as count, hits.http_status, hits.host_id').group(:path_hash, :http_status) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment