提交 672ffd4c 编写于 作者: D Daniel Lobato

Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT field' is the...

Uniq cannot be used directly on an ActiveRecord model. 'DISTINCT field' is the only pluck query that translates into the aforementioned SQL
上级 dbafd36a
......@@ -135,7 +135,7 @@ def calculate(operation, column_name, options = {})
# # SELECT people.id, people.name FROM people
# # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']]
#
# Person.uniq.pluck(:role)
# Person.pluck('DISTINCT role')
# # SELECT DISTINCT role FROM people
# # => ['admin', 'member', 'guest']
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册