CHANGELOG.md 1.7 KB
Newer Older
1 2 3 4
*   Add `#slice!` method to `ActiveModel::Errors`.

    *Daniel López Prat*

5 6 7 8 9 10
*   Fix numericality validator to still use value before type cast except Active Record.

    Fixes #33651, #33686.

    *Ryuta Kamizono*

11 12
*   Fix `ActiveModel::Serializers::JSON#as_json` method for timestamps.

R
Ryuta Kamizono 已提交
13 14 15 16 17 18 19 20 21 22 23
    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"
    ```
24 25 26

    *Bogdan Gusiev*

27 28
*   Allows configurable attribute name for `#has_secure_password`. This
    still defaults to an attribute named 'password', causing no breaking
29
    change. There is a new method `#authenticate_XXX` where XXX is the
30
    configured attribute name, making the existing `#authenticate` now an
31
    alias for this when the attribute is the default 'password'.
R
Ryuta Kamizono 已提交
32

33
    Example:
34

35
        class User < ActiveRecord::Base
36
          has_secure_password :recovery_password, validations: false
37
        end
38

39
        user = User.new()
40 41 42
        user.recovery_password = "42password"
        user.recovery_password_digest # => "$2a$04$iOfhwahFymCs5weB3BNH/uX..."
        user.authenticate_recovery_password('42password') # => user
43

R
Ryuta Kamizono 已提交
44
    *Unathi Chonco*
45

B
bogdanvlviv 已提交
46 47 48 49 50 51
*   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*

J
Jeremy Daer 已提交
52 53 54
*   Rails 6 requires Ruby 2.4.1 or newer.

    *Jeremy Daer*
55 56


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