Listofpopularcities 79 rsid

closes issue #79 
Cool - I don't think you can make group by case insensitive in postgres
<http://www.postgresql.org/message-id/67A0C8B0-C921-11D8-AD52-000A959D1424@intercation.com>,
but I can get around that by writing the query in raw sql like this:
"SELECT MAX(city), state, COUNT(DISTINCT id) AS count FROM restrooms GROUP
BY LOWER(city), state ORDER BY count DESC LIMIT 5"

On Sat, Dec 27, 2014 at 2:30 PM, Teagan <notifications@github.com> wrote:

> In app/models/restroom.rb
> <https://github.com/RefugeRestrooms/refugerestrooms/pull/190#discussion-diff-22294162>
> :
>
> > @@ -59,6 +59,13 @@ def rating_percentage
> >      upvote.to_f / (upvote + downvote).to_f * 100
> >    end
> >
> > +  def self.topcities
> > +    Rails.cache.fetch("topcities", expires_in: 1.month) do
> > +      Restroom.group(:city, :state).count.sort_by {|x,y| y}.reverse
>
> We should probably just handle this case, since the only difference is the
> case. You should be able to make the check case insensitive.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/RefugeRestrooms/refugerestrooms/pull/190/files#r22294162>
> .
>