diff options
Diffstat (limited to 'activerecord/CHANGELOG.md')
-rw-r--r-- | activerecord/CHANGELOG.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 904ac5c26a..5dbd0f6332 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,31 @@ +* Add option to index errors in nested attributes + + For models which have nested attributes, errors within those models will + now be indexed if :index_errors is specified when defining a + has_many relationship, or if its set in the global config. + + E.X. + + ```ruby + class Guitar < ActiveRecord::Base + has_many :tuning_pegs + accepts_nested_attributes_for :tuning_pegs + end + + class TuningPeg < ActiveRecord::Base + belongs_to :guitar + validates_numericality_of :pitch + end + ``` + + - Old style + - `guitar.errors["tuning_pegs.pitch"] = ["is not a number"]` + + - New style (if defined globally, or set in has_many_relationship) + - `guitar.errors["tuning_pegs[1].pitch"] = ["is not a number"]` + + *Michael Probber and Terence Sun* + * Fixed a bug where uniqueness validations would error on out of range values, even if an validation should have prevented it from hitting the database. |