CHANGELOG.md 3.3 KB
Newer Older
1 2
*   Fix date value when casting a multiparameter date hash to not convert
    from Gregorian date to Julian date.
3 4 5 6 7 8 9 10 11 12 13

    Before:

        Day.new({"day(1i)"=>"1", "day(2i)"=>"1", "day(3i)"=>"1"})
        => #<Day id: nil, day: "0001-01-03", created_at: nil, updated_at: nil>

    After:

        Day.new({"day(1i)"=>"1", "day(2i)"=>"1", "day(3i)"=>"1"})
        => #<Day id: nil, day: "0001-01-01", created_at: nil, updated_at: nil>

14
    Fixes #28521.
15 16

    *Sayan Chakraborty*
17

18
*   Fix year value when casting a multiparameter time hash.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

    When assigning a hash to a time attribute that's missing a year component
    (e.g. a `time_select` with `:ignore_date` set to `true`) then the year
    defaults to 1970 instead of the expected 2000. This results in the attribute
    changing as a result of the save.

    Before:
    ```
    event = Event.new(start_time: { 4 => 20, 5 => 30 })
    event.start_time # => 1970-01-01 20:30:00 UTC
    event.save
    event.reload
    event.start_time # => 2000-01-01 20:30:00 UTC
    ```

    After:
    ```
    event = Event.new(start_time: { 4 => 20, 5 => 30 })
    event.start_time # => 2000-01-01 20:30:00 UTC
    event.save
    event.reload
    event.start_time # => 2000-01-01 20:30:00 UTC
    ```

    *Andrew White*


46 47
## Rails 6.0.0.beta1 (January 18, 2019) ##

B
bogdanvlviv 已提交
48 49 50 51
*   Add `ActiveModel::Errors#of_kind?`.

    *bogdanvlviv*, *Rafael Mendonça França*

52 53 54 55 56
*   Fix numericality equality validation of `BigDecimal` and `Float`
    by casting to `BigDecimal` on both ends of the validation.

    *Gannon McGibbon*

57 58 59 60
*   Add `#slice!` method to `ActiveModel::Errors`.

    *Daniel López Prat*

61 62 63 64 65 66
*   Fix numericality validator to still use value before type cast except Active Record.

    Fixes #33651, #33686.

    *Ryuta Kamizono*

67 68
*   Fix `ActiveModel::Serializers::JSON#as_json` method for timestamps.

R
Ryuta Kamizono 已提交
69 70 71 72 73 74 75 76 77 78 79
    Before:
    ```
    contact = Contact.new(created_at: Time.utc(2006, 8, 1))
    contact.as_json["created_at"] # => 2006-08-01 00:00:00 UTC
    ```

    After:
    ```
    contact = Contact.new(created_at: Time.utc(2006, 8, 1))
    contact.as_json["created_at"] # => "2006-08-01T00:00:00.000Z"
    ```
80 81 82

    *Bogdan Gusiev*

83 84
*   Allows configurable attribute name for `#has_secure_password`. This
    still defaults to an attribute named 'password', causing no breaking
85
    change. There is a new method `#authenticate_XXX` where XXX is the
86
    configured attribute name, making the existing `#authenticate` now an
87
    alias for this when the attribute is the default 'password'.
R
Ryuta Kamizono 已提交
88

89
    Example:
90

91
        class User < ActiveRecord::Base
92
          has_secure_password :recovery_password, validations: false
93
        end
94

95
        user = User.new()
96 97 98
        user.recovery_password = "42password"
        user.recovery_password_digest # => "$2a$04$iOfhwahFymCs5weB3BNH/uX..."
        user.authenticate_recovery_password('42password') # => user
99

R
Ryuta Kamizono 已提交
100
    *Unathi Chonco*
101

B
bogdanvlviv 已提交
102 103 104 105 106 107
*   Add `config.active_model.i18n_full_message` in order to control whether
    the `full_message` error format can be overridden at the attribute or model
    level in the locale files. This is `false` by default.

    *Martin Larochelle*

K
Kasper Timm Hansen 已提交
108
*   Rails 6 requires Ruby 2.5.0 or newer.
J
Jeremy Daer 已提交
109

K
Kasper Timm Hansen 已提交
110
    *Jeremy Daer*, *Kasper Timm Hansen*
111 112


113
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activemodel/CHANGELOG.md) for previous changes.