Skip to content

Instantly share code, notes, and snippets.

@fofr
Created October 24, 2013 10:08
Show Gist options
  • Save fofr/7134516 to your computer and use it in GitHub Desktop.
Save fofr/7134516 to your computer and use it in GitHub Desktop.
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