A nice shortcut for group count queries
08-Aug-2019 1814
A nice shortcut for group count queriesVisit.top(:browser)instead ofVisit.group(:browser).where("browser IS NOT NULL").order("count_all DESC, browser").countBe sure to sanitize user input like you must with groupAlso works with arrays and hashes["up", "up", "down"].top(1).
A nice shortcut for group count queries #ruby #rubydeveloper #rubyonrails #shortcut #group #count #queries https://rubyonrails.ba/link/a-nice-shortcut-for-group-count-queries