| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Otherwise we get deprecation warnings in the generated scaffold template files
|
|
|
|
|
|
|
|
| |
instead of 6.0 (#36087)
* Change the deprecation for Enumerating ActiveModel::Errors to Rails 6.1 instead of 6.0
* Changed the deprecation message for ActiveModel::Errors methods: slice, values, keys and to_xml
|
|
|
|
| |
maintaining behavior errors.details[:foo].any?
|
| |
|
| |
|
|
|
|
|
|
| |
Fix double wrapping issue
Revert messages_for wrapping. It's a new method so no need to put
deprecation warnings.
|
|
|
|
| |
Revert some tests to ensure back compatibility
|
| |
|
| |
|
|
|
|
|
| |
autosave duplicate errors can be removed
See SHA 7550f0a016ee6647aaa76c0c0ae30bebc3867288
|
| |
|
|
|
|
| |
This is because we try to accommodate old hash behavior, so `first` and `last` now does not return Error object.
|
|
|
|
|
| |
All enumerable methods must go through the `each` so it retain old hash behavior.
Revert this after Rails 6.1 in order to speed up enumerable methods.
|
|
|
|
|
|
| |
Many operations need grouping of errors by attributes, e.g. ActiveRecord::AutosaveAssociation#association_valid?
Refactor other methods using group_by_attribute
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow `each` to behave in new way if block arity is 1
Ensure dumped marshal from Rails 5 can be loaded
Make errors compatible with marshal and YAML dumps from previous versions of Rails
Add deprecation warnings
Ensure each behave like the past, sorted by attribute
|
|
|
|
|
|
|
| |
Add initialize_dup to deep dup.
Move proc eval and flexible message position out to Errors,
because proc eval is needed for Errors#added? and Errors#delete
|
|
|
|
|
|
| |
- I feel `i18n_customize_full_messages` explains the meaning of the
config better.
- Followup of https://github.com/rails/rails/pull/32956
|
| |
|
|
|
|
| |
Related to https://github.com/rails/rails/pull/34817#issuecomment-451508668
|
| |
|
|
|
|
| |
Fixes #34416
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
- Fix indentation.
- Add a missing dot to the end of the sentence.
Related to #32956
|
| |
|
| |
|
|
|
|
| |
fix rubocop issues
|
|
|
|
|
|
|
|
|
|
| |
Besides making the code easier to read, this commit
also makes it faster:
* We don't eval `@base.class.respond_to?(:i18n_scope)` twice
* We only eval `@base.class.i18n_scope` once
* We don't call `flatten!` because it's not needed anymore
* We don't call `compact` because all elements are Symbols
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ActiveModel::Errors#merge! allows ActiveModel::Errors to append errors from
a separate ActiveModel::Errors instance onto their own.
Example:
person = Person.new
person.errors.add(:name, :blank)
errors = ActiveModel::Errors.new(Person.new)
errors.add(:name, :invalid)
person.errors.merge!(errors)
puts person.errors.messages
# => { name: ["can't be blank", "is invalid"] }
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
|
|
|
|
|
| |
`messages` has `default_proc` so calling `reject` causes the warning.
https://github.com/ruby/ruby/blob/v2_4_1/hash.c#L1335-L1337
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before:
person.errors.keys # => []
person.errors.values # => []
person.errors[:name] # => []
person.errors.keys # => [:name]
person.errors.values # => [[]]
After:
person.errors.keys # => []
person.errors.values # => []
person.errors[:name] # => []
person.errors.keys # => []
person.errors.values # => []
Related to #23468
|
|
|
|
|
|
|
| |
If a Error object was serialized in the database as YAML in the Rails
4.2 version, if we load in the Rails 5.0 version it will miss the
@details instance variable so methods like #clear and #add will start to
fail.
|
|
|
|
|
|
| |
`#[]` has already applied indifferent access, but some methods does not.
`#include?`, `#has_key?`, `#key?`, `#delete` and `#full_messages_for`.
|
| |
|
|
|
|
| |
`#get`, `#set`, `[]=`, `add_on_empty` and `add_on_blank`.
|
| |
|
|
|
| |
This fixes a copy-and-paste-issue slipped in by #18996
|
|
|
|
| |
Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
|
|
|
|
|
|
|
|
|
| |
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.
Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
| |
Fix a tiny typo and vertical-align some return results in the
ActiveModel::Errors documentation.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now use default procs inside of the errors object, which gets
included by default when marshaling anything that includes
`ActiveModel::Validations`. This means that Active Record objects cannot
be marshalled. We strip and apply the default proc ourselves. This will
ensure the objects are YAML serializable as well, since YAML falls back
to marshal implementations now. This is less important, however, as the
errors aren't included when dumping Active Record objects.
This commit does not include a changelog entry, as 5.0 is still in RC
status at the time of writing, and 5.0.0 will not release with the bug
this fixes.
Fixes #25165
|
|\
| |
| |
| |
| | |
Conflicts:
guides/source/configuring.md
|
| |
| |
| |
| | |
[ci skip]
|