aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/CHANGELOG.md
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/CHANGELOG.md')
-rw-r--r--activemodel/CHANGELOG.md118
1 files changed, 81 insertions, 37 deletions
diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md
index 5b0f2cd666..54fe5794e1 100644
--- a/activemodel/CHANGELOG.md
+++ b/activemodel/CHANGELOG.md
@@ -1,67 +1,111 @@
-* Passwords with spaces only allowed in `ActiveModel::SecurePassword`.
+* Add case_sensitive option for confirmation validator in models.
- Presence validation can be used to restore old behavior.
+ *Akshat Sharma*
- *Yevhene Shemet*
+* Ensure `method_missing` is called for methods passed to
+ `ActiveModel::Serialization#serializable_hash` that don't exist.
-* Validate options passed to `ActiveModel::Validations.validate`.
+ *Jay Elaraj*
- Preventing, in many cases, the simple mistake of using `validate` instead of `validates`.
+* Remove `ActiveModel::Serializers::Xml` from core.
- *Sonny Michaud*
+ *Zachary Scott*
-* Deprecate `reset_#{attribute}` in favor of `restore_#{attribute}`.
+* Add `ActiveModel::Dirty#[attr_name]_previously_changed?` and
+ `ActiveModel::Dirty#[attr_name]_previous_change` to improve access
+ to recorded changes after the model has been saved.
- These methods may cause confusion with the `reset_changes`, which has
- different behaviour.
+ It makes the dirty-attributes query methods consistent before and after
+ saving.
- *Rafael Mendonça França*
+ *Fernando Tapia Rico*
-* Deprecate `ActiveModel::Dirty#reset_changes` in favor of `#clear_changes_information`.
+* Deprecate the `:tokenizer` option for `validates_length_of`, in favor of
+ plain Ruby.
- Method's name is causing confusion with the `reset_#{attribute}` methods.
- While `reset_name` sets the value of the name attribute to previous value
- `reset_changes` only discards the changes.
+ *Sean Griffin*
- *Rafael Mendonça França*
+* Deprecate `ActiveModel::Errors#add_on_empty` and `ActiveModel::Errors#add_on_blank`
+ with no replacement.
-* Added `restore_attributes` method to `ActiveModel::Dirty` API which restores
- the value of changed attributes to previous value.
+ *Wojciech Wnętrzak*
- *Igor G.*
+* Deprecate `ActiveModel::Errors#get`, `ActiveModel::Errors#set` and
+ `ActiveModel::Errors#[]=` methods that have inconsistent behavior.
-* Allow proc and symbol as values for `only_integer` of `NumericalityValidator`
+ *Wojciech Wnętrzak*
- *Robin Mehner*
+* Allow symbol as values for `tokenize` of `LengthValidator`.
-* `has_secure_password` now verifies that the given password is less than 72
- characters if validations are enabled.
+ *Kensuke Naito*
- Fixes #14591.
+* Assigning an unknown attribute key to an `ActiveModel` instance during initialization
+ will now raise `ActiveModel::AttributeAssignment::UnknownAttributeError` instead of
+ `NoMethodError`.
- *Akshay Vishnoi*
+ Example:
-* Remove deprecated `Validator#setup` without replacement.
+ User.new(foo: 'some value')
+ # => ActiveModel::AttributeAssignment::UnknownAttributeError: unknown attribute 'foo' for User.
- See #10716.
+ *Eugene Gilburg*
- *Kuldeep Aggarwal*
+* Extracted `ActiveRecord::AttributeAssignment` to `ActiveModel::AttributeAssignment`
+ allowing to use it for any object as an includable module.
-* Add plural and singular form for length validator's default messages.
+ Example:
- *Abd ar-Rahman Hamid*
+ class Cat
+ include ActiveModel::AttributeAssignment
+ attr_accessor :name, :status
+ end
-* Introduce `validate` as an alias for `valid?`.
+ cat = Cat.new
+ cat.assign_attributes(name: "Gorby", status: "yawning")
+ cat.name # => 'Gorby'
+ cat.status # => 'yawning'
+ cat.assign_attributes(status: "sleeping")
+ cat.name # => 'Gorby'
+ cat.status # => 'sleeping'
- This is more intuitive when you want to run validations but don't care about
- the return value.
+ *Bogdan Gusiev*
- *Henrik Nyh*
+* Add `ActiveModel::Errors#details`
-* Add case_sensitive option for confirmation validator in models.
+ To be able to return type of used validator, one can now call `details`
+ on errors instance.
- See #17351
+ Example:
+
+ class User < ActiveRecord::Base
+ validates :name, presence: true
+ end
+
+ user = User.new; user.valid?; user.errors.details
+ => {name: [{error: :blank}]}
+
+ *Wojciech Wnętrzak*
+
+* Change validates_acceptance_of to accept true by default.
+
+ The default for validates_acceptance_of is now "1" and true.
+ In the past, only "1" was the default and you were required to add
+ accept: true.
+
+* Remove deprecated `ActiveModel::Dirty#reset_#{attribute}` and
+ `ActiveModel::Dirty#reset_changes`.
+
+ *Rafael Mendonça França*
+
+* Change the way in which callback chains can be halted.
+
+ The preferred method to halt a callback chain from now on is to explicitly
+ `throw(:abort)`.
+ In the past, returning `false` in an ActiveModel or ActiveModel::Validations
+ `before_` callback had the side effect of halting the callback chain.
+ This is not recommended anymore and, depending on the value of the
+ `config.active_support.halt_callback_chains_on_return_false` option, will
+ either not work at all or display a deprecation warning.
- *Akshat Sharma*
-Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/activemodel/CHANGELOG.md) for previous changes.
+Please check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activemodel/CHANGELOG.md) for previous changes.