diff options
author | Paul Yoder <paulyoder@gmail.com> | 2011-01-31 13:48:58 -0600 |
---|---|---|
committer | Paul Yoder <paulyoder@gmail.com> | 2011-01-31 13:48:58 -0600 |
commit | cb3e6c36657d7e335bbb41d3672197963308705e (patch) | |
tree | b08bb5f7421fb8dee3a0f496a8356bb7eccac5c9 /railties | |
parent | d1ef543794efdcc1d225055f88cbc88b20e84921 (diff) | |
download | rails-cb3e6c36657d7e335bbb41d3672197963308705e.tar.gz rails-cb3e6c36657d7e335bbb41d3672197963308705e.tar.bz2 rails-cb3e6c36657d7e335bbb41d3672197963308705e.zip |
small edit on options extraction documentation
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index c283a9bd99..cf9ebf44e6 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -2007,7 +2007,7 @@ User.exists?(:email => params[:email]) That syntactic sugar is used a lot in Rails to avoid positional arguments where there would be too many, offering instead interfaces that emulate named parameters. In particular it is very idiomatic to use a trailing hash for options. -If a method expects a variable number of arguments and uses <tt>*</tt> in its declaration, however, such an options hash ends up being an item of the array of arguments, where kind of loses its role. +If a method expects a variable number of arguments and uses <tt>*</tt> in its declaration, however, such an options hash ends up being an item of the array of arguments, where it loses its role. In those cases, you may give an options hash a distinguished treatment with +extract_options!+. That method checks the type of the last item of an array. If it is a hash it pops it and returns it, otherwise returns an empty hash. |