aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaurish Sharma <contact@gaurishsharma.com>2012-11-08 19:14:35 +0530
committerGaurish Sharma <contact@gaurishsharma.com>2012-11-08 19:14:35 +0530
commite3e4fa1f6504ba27200c25558462dd2ba6c1fcd3 (patch)
treef432120cf4a923e283c9546e36d907205cd5dcfc
parent8659212df2d29dc1c3b20a58dde00a56a776817d (diff)
downloadrails-e3e4fa1f6504ba27200c25558462dd2ba6c1fcd3.tar.gz
rails-e3e4fa1f6504ba27200c25558462dd2ba6c1fcd3.tar.bz2
rails-e3e4fa1f6504ba27200c25558462dd2ba6c1fcd3.zip
make syntax of select.map(&:field) same as pluck
The shortcut ampersand syntax of `select.map(&:field)` is same thing as `.plunk(:field)`. document that
-rw-r--r--guides/source/active_record_querying.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index da56d55deb..d5c23b416c 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -1364,6 +1364,8 @@ Client.pluck(:id, :name)
```ruby
Client.select(:id).map { |c| c.id }
# or
+Client.select(:id).map(&:id)
+# or
Client.select(:id).map { |c| [c.id, c.name] }
```