diff options
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r-- | activemodel/CHANGELOG.md | 80 |
1 files changed, 33 insertions, 47 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index 500d8dc42f..c14b0688c7 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -1,72 +1,58 @@ -* `#to_param` returns `nil` if `#to_key` returns `nil`. Fixes #11399. +* Passwords with spaces only allowed in `ActiveModel::SecurePassword`. - *Yves Senn* + Presence validation can be used to restore old behavior. -* Ability to specify multiple contexts when defining a validation. + *Yevhene Shemet* - Example: +* Validate options passed to `ActiveModel::Validations.validate`. - class Person - include ActiveModel::Validations + Preventing, in many cases, the simple mistake of using `validate` instead of `validates`. - attr_reader :name - validates_presence_of :name, on: [:verify, :approve] - end + *Sonny Michaud* - person = Person.new - person.valid? # => true - person.valid?(:verify) # => false - person.errors.full_messages_for(:name) # => ["Name can't be blank"] - person.valid?(:approve) # => false - person.errors.full_messages_for(:name) # => ["Name can't be blank"] +* Deprecate `reset_#{attribute}` in favor of `restore_#{attribute}`. - *Vince Puzzella* + These methods may cause confusion with the `reset_changes` that behaves differently + of them. -* `attribute_changed?` now accepts a hash to check if the attribute was - changed `:from` and/or `:to` a given value. +* Deprecate `ActiveModel::Dirty#reset_changes` in favor of `#clear_changes_information`. - Example: + This method name is causing confusion with the `reset_#{attribute}` + methods. While `reset_name` set the value of the name attribute for the + previous value `reset_changes` only discard the changes and previous + changes. - model.name_changed?(from: "Pete", to: "Ringo") +* Added `restore_attributes` method to `ActiveModel::Dirty` API to restore all the + changed values to the previous data. - *Tejas Dinkar* + *Igor G.* -* Fix `has_secure_password` to honor bcrypt-ruby's cost attribute. +* Allow proc and symbol as values for `only_integer` of `NumericalityValidator` - *T.J. Schuck* + *Robin Mehner* -* Updated the `ActiveModel::Dirty#changed_attributes` method to be indifferent between using - symbols and strings as keys. +* `has_secure_password` now verifies that the given password is less than 72 + characters if validations are enabled. - *William Myers* + Fixes #14591. -* Added new API methods `reset_changes` and `changes_applied` to `ActiveModel::Dirty` - that control changes state. Previsously you needed to update internal - instance variables, but now API methods are available. + *Akshay Vishnoi* - *Bogdan Gusiev* +* Remove deprecated `Validator#setup` without replacement. -* Fix `has_secure_password` not to trigger `password_confirmation` validations - if no `password_confirmation` is set. + See #10716. - *Vladimir Kiselev* + *Kuldeep Aggarwal* -* `inclusion` / `exclusion` validations with ranges will only use the faster - `Range#cover` for numerical ranges, and the more accurate `Range#include?` - for non-numerical ones. +* Add plural and singular form for length validator's default messages. - Fixes range validations like `:a..:f` that used to pass with values like `:be`. - Fixes #10593. + *Abd ar-Rahman Hamid* - *Charles Bergeron* +* Introduce `validate` as an alias for `valid?`. -* Fix regression in `has_secure_password`. When a password is set, but a - confirmation is an empty string, it would incorrectly save. + This is more intuitive when you want to run validations but don't care about + the return value. - *Steve Klabnik* and *Phillip Calvin* + *Henrik Nyh* -* Deprecate `Validator#setup`. This should be done manually now in the validator's constructor. - - *Nick Sutterer* - -Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activemodel/CHANGELOG.md) for previous changes. +Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activemodel/CHANGELOG.md) for previous changes. |