diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-22 09:30:00 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-22 09:32:41 -0300 |
commit | e5cd300becab8e05f4568a402e3fce4f4497733a (patch) | |
tree | 238a37bc01acbcebd7a463fc08ba8e813a4d79c5 /activerecord | |
parent | 6aae17e85613fe8c2816ba278f9348f168692479 (diff) | |
download | rails-e5cd300becab8e05f4568a402e3fce4f4497733a.tar.gz rails-e5cd300becab8e05f4568a402e3fce4f4497733a.tar.bz2 rails-e5cd300becab8e05f4568a402e3fce4f4497733a.zip |
Add changelog entry and guide updates for pluck with multiple columns
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/CHANGELOG.md | 9 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f2248efd71..860ceae04a 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,5 +1,14 @@ ## Rails 4.0.0 (unreleased) ## +* Allow ActiveRecord::Relation#pluck to accept multiple columns. Returns an + array of arrays containing the type casted values: + + Person.pluck(:id, :name) + # SELECT people.id, people.name FROM people + # [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']] + + *Jeroen van Ingen & Carlos Antonio da Silva* + * Improve the derivation of HABTM join table name to take account of nesting. It now takes the table names of the two models, sorts them lexically and then joins them, stripping any common prefix from the second table name. diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 9c27392299..86eb8f35b5 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -140,6 +140,7 @@ module ActiveRecord # # Person.pluck(:id, :name) # # SELECT people.id, people.name FROM people + # # => [[1, 'David'], [2, 'Jeremy'], [3, 'Jose']] # # Person.uniq.pluck(:role) # # SELECT DISTINCT role FROM people |