【发布时间】:2018-11-27 13:50:09
【问题描述】:
我有一个班级Restaurant:
Restaurant(id: integer, name: string, url: string, address: string
我想得到url 和name 的所有不同组合并计算它们。我该怎么做?
我试过了
Restaurant.select(:url, :name).distinct.count
但我明白了:
No function matches the given name and argument types. You might need to add explicit type casts.
【问题讨论】:
-
它适用于我的模型。????只是出于好奇,请尝试
Restaurant.all.select(:url, :name).distinct。 -
对不起。我忘了添加导致错误的
.count。
标签: ruby-on-rails