diff options
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r-- | activesupport/CHANGELOG.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 66b7365916..be1862279c 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,26 @@ ## Rails 6.0.0.alpha (Unreleased) ## +* Add `private: true` option to ActiveSupport's `delegate`. + + In order to delegate methods as private methods: + + class User < ActiveRecord::Base + has_one :profile + delegate :date_of_birth, to: :profile, private: true + + def age + Date.today.year - date_of_birth.year + end + end + + # User.new.age # => 29 + # User.new.date_of_birth + # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340> + + More information in #31944. + + *Tomas Valent* + * `String#truncate_bytes` to truncate a string to a maximum bytesize without breaking multibyte characters or grapheme clusters like 👩👩👦👦. |