diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-02-26 20:49:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-26 20:49:01 +0100 |
commit | 9cf7e79fa28f43ff8eba4b921d0b453a9775924d (patch) | |
tree | 379da94baefaa6ac3b8845e6f706ee142baa921f /activesupport/CHANGELOG.md | |
parent | 87de79e9cc25fe6ac02095a1d0c014941a39ede8 (diff) | |
parent | 06f067506854d9fbecf9694c210468323208d6bb (diff) | |
download | rails-9cf7e79fa28f43ff8eba4b921d0b453a9775924d.tar.gz rails-9cf7e79fa28f43ff8eba4b921d0b453a9775924d.tar.bz2 rails-9cf7e79fa28f43ff8eba4b921d0b453a9775924d.zip |
Merge pull request #31944 from equivalent/delegate_private
delegate to, with private: true option
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r-- | activesupport/CHANGELOG.md | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 66b7365916..190ec4e6de 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,5 +1,42 @@ ## 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* + +* Return all mappings for a timezone identifier in `country_zones` + + Some timezones like `Europe/London` have multiple mappings in + `ActiveSupport::TimeZone::MAPPING` so return all of them instead + of the first one found by using `Hash#value`. e.g: + + # Before + ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"] + + # After + ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"] + + Fixes #31668. + + *Andrew White* + * `String#truncate_bytes` to truncate a string to a maximum bytesize without breaking multibyte characters or grapheme clusters like 👩👩👦👦. |