diff options
author | Arun Agrawal <arunagw@gmail.com> | 2011-12-02 23:15:08 +0530 |
---|---|---|
committer | Arun Agrawal <arunagw@gmail.com> | 2011-12-02 23:15:08 +0530 |
commit | 3d550e5174d99e12fc7efe8273aa4eb970cfeeaf (patch) | |
tree | aad01ca6779496c5afc0a1d7207fb65dd49884cd /railties/guides/source | |
parent | 9f623e21094a2797cd438eb03a6bccb2e359da62 (diff) | |
download | rails-3d550e5174d99e12fc7efe8273aa4eb970cfeeaf.tar.gz rails-3d550e5174d99e12fc7efe8273aa4eb970cfeeaf.tar.bz2 rails-3d550e5174d99e12fc7efe8273aa4eb970cfeeaf.zip |
Added doc about pluck for active_support core ext
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index fbccff5005..76d757f6a7 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2053,6 +2053,16 @@ end NOTE: Defined in +active_support/core_ext/enumerable.rb+. +h4. +pluck+ + +Plucks the value of the passed method for each element and returns the result as an array + +<ruby> +people.pluck(:name) # => [ "David Heinemeier Hansson", "Jamie Heinemeier Hansson" ] +</ruby> + +NOTE: Defined in +active_support/core_ext/enumerable.rb+. + h4. +each_with_object+ The +inject+ method offers iteration with an accumulator: |