diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2018-04-04 07:35:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-04 07:35:39 -0400 |
commit | 50bfb263a130d781e992a1933589a451d54ba212 (patch) | |
tree | f58cf0acc7121d1bcf6b25f8a8d6f3e8e7bebc85 /guides/source | |
parent | a07d0680787ced3c04b362fa7a238c918211ac70 (diff) | |
parent | 34a10e0c414548849c7ff3a0879a58dc0d84a9a4 (diff) | |
download | rails-50bfb263a130d781e992a1933589a451d54ba212.tar.gz rails-50bfb263a130d781e992a1933589a451d54ba212.tar.bz2 rails-50bfb263a130d781e992a1933589a451d54ba212.zip |
Merge pull request #32448 from yhirano55/add_private_option_to_delegate_section_in_guide
[ci skip] Add :private option to delegate section in guide
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 75ad343613..ae2e1faf14 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -779,6 +779,14 @@ delegate :size, to: :attachment, prefix: :avatar In the previous example the macro generates `avatar_size` rather than `size`. +The option `:private` changes methods scope: + +```ruby +delegate :date_of_birth, to: :profile, private: true +``` + +The delegated methods are public by default. Pass `private: true` to change that. + NOTE: Defined in `active_support/core_ext/module/delegation.rb` #### `delegate_missing_to` |