diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2015-12-17 13:34:08 -0200 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2015-12-17 13:34:08 -0200 |
commit | 0957c8ad6722c1a82c16f70b23fe1f7cb2607ff5 (patch) | |
tree | 83b2e418dd86ec2ebf9eccfc78939581d900bf8d | |
parent | 0ff5fa14a3d4c849bcd1e98de3db48de4b96190c (diff) | |
parent | 0c28a064957a507ff588788797924edf177e03db (diff) | |
download | rails-0957c8ad6722c1a82c16f70b23fe1f7cb2607ff5.tar.gz rails-0957c8ad6722c1a82c16f70b23fe1f7cb2607ff5.tar.bz2 rails-0957c8ad6722c1a82c16f70b23fe1f7cb2607ff5.zip |
Merge pull request #22640 from nateberkopec/fix-my-typo-and-clarify
Clarify thread_mattr_accessor subclass behavior documentation
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb index 6f9cdf772d..d2d89ec2d7 100644 --- a/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +++ b/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb @@ -96,23 +96,24 @@ class Module # Defines both class and instance accessors for class attributes. # - # class Current + # class Account # thread_mattr_accessor :user # end # - # Current.user = "DHH" - # Current.user # => "DHH" - # Current.new.user # => "DHH" + # Account.user = "DHH" + # Account.user # => "DHH" + # Account.new.user # => "DHH" # - # If a subclass changes the value then that will not change the value for - # parent class. Similarly if parent class changes the value then that will not - # change the value of subclasses either. + # If a subclass changes the value, the parent class' value is not changed. + # Similarly, if the parent class changes the value, the value of subclasses + # is not changed. # # class Customer < Account # end # # Customer.user = "Rafael" - # Account.user # => "DHH" + # Customer.user # => "Rafael" + # Account.user # => "DHH" # # To opt out of the instance writer method, pass <tt>instance_writer: false</tt>. # To opt out of the instance reader method, pass <tt>instance_reader: false</tt>. |