1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/CHANGELOG.md
Rafael França 9a9ef9639e
Merge pull request #32185 from nholden/human_readable_date_time_comparisons
Add `before?` and `after?` methods to date and time classes
2018-03-26 18:33:03 -04:00

1.8 KiB

  • Fix bug where URI.unscape would fail with mixed Unicode/escaped character input:

    URI.unescape("\xe3\x83\x90")  # => "バ"
    URI.unescape("%E3%83%90")  # => "バ"
    URI.unescape("\xe3\x83\x90%E3%83%90")  # => Encoding::CompatibilityError
    

    Ashe Connor, Aaron Patterson

  • Add before? and after? methods to Date, DateTime, Time, and TimeWithZone.

    Nick Holden

  • Add :private option to ActiveSupport's Module#delegate in order to delegate methods as private:

    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>
    

    Tomas Valent

  • String#truncate_bytes to truncate a string to a maximum bytesize without breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.

    Jeremy Daer

  • String#strip_heredoc preserves frozenness.

    "foo".freeze.strip_heredoc.frozen?  # => true
    

    Fixes that frozen string literals would inadvertently become unfrozen:

    # frozen_string_literal: true
    
    foo = <<-MSG.strip_heredoc
      la la la
    MSG
    
    foo.frozen?  # => false !??
    

    Jeremy Daer

  • Rails 6 requires Ruby 2.4.1 or newer.

    Jeremy Daer

  • Adds parallel testing to Rails.

    Parallelize your test suite with forked processes or threads.

    Eileen M. Uchitelle, Aaron Patterson

Please check 5-2-stable for previous changes.