instance method
select_values
Ruby on Rails 7.1.6
Since v2.2.3Signature
select_values(arel, name = nil, binds = [])
Returns an array of the values of the first column in a select:
select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
Parameters
-
arelreq -
nameopt = nil -
bindsopt = []
Source
# File activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb, line 89
def select_values(arel, name = nil, binds = [])
select_rows(arel, name, binds).map(&:first)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb line 89
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::DatabaseStatements