instance method
select_values
Ruby on Rails 4.0.13
Since v2.2.3Signature
select_values(arel, name = nil)
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
Source
# File activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb, line 44
def select_values(arel, name = nil)
arel, binds = binds_from_relation arel, []
select_rows(to_sql(arel, binds), name, binds).map(&:first)
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb line 44
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::DatabaseStatements