diff options
author | Yoshiyuki Hirano <yhirano@me.com> | 2018-04-04 20:04:10 +0900 |
---|---|---|
committer | Yoshiyuki Hirano <yhirano@me.com> | 2018-04-04 20:05:45 +0900 |
commit | 34a10e0c414548849c7ff3a0879a58dc0d84a9a4 (patch) | |
tree | 6d4677f87b0fb3d207f68c51173b25cc5d6322e7 /guides | |
parent | 57a9661a9c24ffdbb558cbbc456d8655204840a7 (diff) | |
download | rails-34a10e0c414548849c7ff3a0879a58dc0d84a9a4.tar.gz rails-34a10e0c414548849c7ff3a0879a58dc0d84a9a4.tar.bz2 rails-34a10e0c414548849c7ff3a0879a58dc0d84a9a4.zip |
[ci skip] Add :private option to delegate section in guide
Diffstat (limited to 'guides')
-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` |