diff options
author | Kevin Deisz <kevin.deisz@gmail.com> | 2015-05-28 21:29:57 -0400 |
---|---|---|
committer | Kevin Deisz <kevin.deisz@gmail.com> | 2015-05-28 21:29:57 -0400 |
commit | d8f163548562795ca56b2e405fd38b24ce890144 (patch) | |
tree | 8542f801c17f0024ee28c2abf10e03f3b61f8ecb /guides/source | |
parent | 3a8656bfd13bdb68797a89f6dfe409044f8c245a (diff) | |
download | rails-d8f163548562795ca56b2e405fd38b24ce890144.tar.gz rails-d8f163548562795ca56b2e405fd38b24ce890144.tar.bz2 rails-d8f163548562795ca56b2e405fd38b24ce890144.zip |
Updating the guides for Enumerable#pluck
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 047999d4cf..e6475f2bb5 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -2193,6 +2193,16 @@ removed: NOTE: Defined in `active_support/core_ext/enumerable.rb`. +### `pluck` + +The method `pluck` returns an array based on the given key: + +```ruby +[{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name) # => ["David", "Rafael", "Aaron"] +``` + +NOTE: Defined in `active_support/core_ext/enumerable.rb`. + Extensions to `Array` --------------------- |