diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2010-05-17 02:11:56 +0430 |
---|---|---|
committer | Rizwan Reza <rizwanreza@gmail.com> | 2010-05-17 02:11:56 +0430 |
commit | 4679b72cba371eee30cb77d9077a0bb8727a0654 (patch) | |
tree | 7fe24569277436583c05f67c97b52cb277279b88 /railties/guides/source | |
parent | 5de2e0d416b0635fc99655fbfcb24acddf5536e5 (diff) | |
download | rails-4679b72cba371eee30cb77d9077a0bb8727a0654.tar.gz rails-4679b72cba371eee30cb77d9077a0bb8727a0654.tar.bz2 rails-4679b72cba371eee30cb77d9077a0bb8727a0654.zip |
Changed guide to use random_element.
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index b7b5f47eef..72194e567a 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1894,10 +1894,10 @@ Similarly, +from+ returns the tail from the element at the passed index on: The methods +second+, +third+, +fourth+, and +fifth+ return the corresponding element (+first+ is builtin). Thanks to social wisdom and positive constructiveness all around, +forty_two+ is also available. -You can pick a random element with +rand+: +You can pick a random element with +random_element+: <ruby> -shape_type = [Circle, Square, Triangle].rand +shape_type = [Circle, Square, Triangle].random_element </ruby> NOTE: Defined in +active_support/core_ext/array/access.rb+. |