aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2018-07-14 13:38:13 -0400
committerGitHub <noreply@github.com>2018-07-14 13:38:13 -0400
commita8d63c2fad0ca968b8685a0c134d9cdc8e5aae6c (patch)
tree3fb67025e3f09d3c3cf2ccb55cd8cc3ed1518a5a
parentbd5eba1adff8fa72429f5889ae26097e9756ceb0 (diff)
parent1e2650acbb1178da7d24bb9cdac31920c2f75dc9 (diff)
downloadrails-a8d63c2fad0ca968b8685a0c134d9cdc8e5aae6c.tar.gz
rails-a8d63c2fad0ca968b8685a0c134d9cdc8e5aae6c.tar.bz2
rails-a8d63c2fad0ca968b8685a0c134d9cdc8e5aae6c.zip
Merge pull request #33360 from jedrekdomanski/Update-active-record-querying-readme
Update documentation for #pluck method [ci skip]
-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: