aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorJędrek Domański <jedrek.domanski@gmail.com>2018-07-14 14:11:30 +0200
committerJędrek Domański <jedrek.domanski@gmail.com>2018-07-14 14:11:30 +0200
commit1e2650acbb1178da7d24bb9cdac31920c2f75dc9 (patch)
tree3fb67025e3f09d3c3cf2ccb55cd8cc3ed1518a5a /guides
parentbd5eba1adff8fa72429f5889ae26097e9756ceb0 (diff)
downloadrails-1e2650acbb1178da7d24bb9cdac31920c2f75dc9.tar.gz
rails-1e2650acbb1178da7d24bb9cdac31920c2f75dc9.tar.bz2
rails-1e2650acbb1178da7d24bb9cdac31920c2f75dc9.zip
Update documentation for #pluck method [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/active_record_querying.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 944cee8a23..6c57cd8b8e 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -1777,6 +1777,12 @@ Client.pluck(:name)
# => ["David", "Jeremy", "Jose"]
```
+You are not limited to querying fields from a single table, you can query multiple tables as well.
+
+```
+Client.joins(:comments, :categories).pluck("clients.email, comments.title, categories.name")
+```
+
Furthermore, unlike `select` and other `Relation` scopes, `pluck` triggers an immediate
query, and thus cannot be chained with any further scopes, although it can work with
scopes already constructed earlier: