From c46c303c86bd50cc7d448da4b0e360e35fb0313b Mon Sep 17 00:00:00 2001 From: Jay Hayes Date: Fri, 15 Dec 2017 14:32:52 -0600 Subject: Clarify docs for delegate :allow_nil option --- activesupport/lib/active_support/core_ext/module/delegation.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'activesupport/lib') 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 :allow_nil 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 :allow_nil option. # # class User < ActiveRecord::Base # has_one :profile -- cgit v1.2.3