How can I count the result of an ActiveRecord .group query? Chaining .count returns a hash

前端 未结 6 1189
萌比男神i
萌比男神i 2021-01-08 00:51

I can use the following :

User.where(\"zip_code = \'48104\'\").group(\'users.id\').count

To get hashes like :

{195=>1, 1         


        
6条回答
提交回复
热议问题