提交 7bfc6ea1 编写于 作者: R Ryuta Kamizono

Use `select_rows` instead of `select_one` in `select_value`

`select_one` create `ActiveRecord::Result` instance. It is better to use
`select_rows` instead of `select_one` for performance.
上级 984a4db3
......@@ -40,8 +40,9 @@ def select_one(arel, name = nil, binds = [])
# Returns a single value from a record
def select_value(arel, name = nil, binds = [])
if result = select_one(arel, name, binds)
result.values.first
arel, binds = binds_from_relation arel, binds
if result = select_rows(to_sql(arel, binds), name, binds).first
result.first
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册