aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2017-12-18 10:01:32 -0500
committerGitHub <noreply@github.com>2017-12-18 10:01:32 -0500
commit6553c7fef702331c47001e1003067fd555aa7ccd (patch)
treead44cd2dce5af7d7bded1462ef419faae1fa373b /activesupport
parentb2be83fc2c7e8390500e78ba443ef802374e83a0 (diff)
parentc46c303c86bd50cc7d448da4b0e360e35fb0313b (diff)
downloadrails-6553c7fef702331c47001e1003067fd555aa7ccd.tar.gz
rails-6553c7fef702331c47001e1003067fd555aa7ccd.tar.bz2
rails-6553c7fef702331c47001e1003067fd555aa7ccd.zip
Merge pull request #31479 from iamvery/reword-delegate-allow-nil-paragraph
Clarify docs for delegate :allow_nil option
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/module/delegation.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/delegation.rb b/activesupport/lib/active_support/core_ext/module/delegation.rb
index a77f903db5..4310df3024 100644
--- a/activesupport/lib/active_support/core_ext/module/delegation.rb
+++ b/activesupport/lib/active_support/core_ext/module/delegation.rb
@@ -115,11 +115,8 @@ class Module
# invoice.customer_address # => 'Vimmersvej 13'
#
# If the target is +nil+ and does not respond to the delegated method a
- # +Module::DelegationError+ is raised, as with any other value. Sometimes,
- # however, it makes sense to be robust to that situation and that is the
- # purpose of the <tt>:allow_nil</tt> option: If the target is not +nil+, or it
- # is and responds to the method, everything works as usual. But if it is +nil+
- # and does not respond to the delegated method, +nil+ is returned.
+ # +Module::DelegationError+ is raised. If you wish to instead return +nil+,
+ # use the <tt>:allow_nil</tt> option.
#
# class User < ActiveRecord::Base
# has_one :profile