aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2016-01-08 01:44:05 -0200
committerRafael França <rafaelmfranca@gmail.com>2016-01-08 01:44:05 -0200
commit078d86b655c4e7c8a894102d0b599cca144fe767 (patch)
treec9811c46b38ebd43326082fc6e2e1edf089f0fd9 /activerecord/lib
parent2a1312eb9f2314e6fdd19058b2477b3a4464774f (diff)
parent2827fcd2f96e1554236fe435c73b767eebeb4e94 (diff)
downloadrails-078d86b655c4e7c8a894102d0b599cca144fe767.tar.gz
rails-078d86b655c4e7c8a894102d0b599cca144fe767.tar.bz2
rails-078d86b655c4e7c8a894102d0b599cca144fe767.zip
Merge pull request #22973 from kamipo/fix_select_values_method_signature
Fix `select_values` method signature for consistency
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb4
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
index 24418db2e9..0ac5e80119 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
@@ -58,8 +58,8 @@ module ActiveRecord
# Returns an array of the values of the first column in a select:
# select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]
- def select_values(arel, name = nil)
- arel, binds = binds_from_relation arel, []
+ def select_values(arel, name = nil, binds = [])
+ arel, binds = binds_from_relation arel, binds
select_rows(to_sql(arel, binds), name, binds).map(&:first)
end
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index 2dcc10c5cb..11a151edd5 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -52,8 +52,8 @@ module ActiveRecord
end
end
- def select_values(arel, name = nil)
- arel, binds = binds_from_relation arel, []
+ def select_values(arel, name = nil, binds = [])
+ arel, binds = binds_from_relation arel, binds
sql = to_sql(arel, binds)
execute_and_clear(sql, name, binds) do |result|
if result.nfields > 0