| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
- we are ending sentences properly
- fixing of space issues
- fixed continuity issues in some sentences.
Reverts https://github.com/rails/rails/commit/8fc97d198ef31c1d7a4b9b849b96fc08a667fb02 .
This change reverts making sure we add '.' at end of deprecation sentences.
This is to keep sentences within Rails itself consistent and with a '.' at the end.
|
|
|
|
|
|
|
|
|
| |
- Pass object to I18n helper so that when calling message proc, it will
pass that object as argument to the proc and we can generate custom
error messages based on current record being validated.
- Based on https://github.com/rails/rails/issues/856.
[Łukasz Bandzarewicz, Prathamesh Sonpatki]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From: https://github.com/rails/rails/issues/24279
Problem:
By doing `record.errors.include? :foo`, it adds a new key to the
@messages hash that defaults to an empty array.
This happens because of a combination of these 2 commits:
https://github.com/rails/rails/commit/b97035df64f5b2f912425c4a7fcb6e6bb3ddab8d
(Added in Rails 4.1)
and
https://github.com/rails/rails/commit/6ec8ba16d85d5feaccb993c9756c1edcbbf0ba13#diff-fdcf8b65b5fb954372c6fe1ddf284c78R76
(Rails 5.0)
By adding the default proc that returns an array for non-existing keys,
ruby adds that key to the hash.
Solution:
Change `#include?` to check with `has_key?` and then check if that value is
`present?`.
Add test case for ActiveModels::Errors#include?
|
|
|
|
|
|
| |
The `attribute` parameter is not used inside the `normalize_detail`
method. This does not need to go through a deprecation cycle, since the
method is private.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
I believe this is a use case that was supposed to be supported, and it's
a small fix.
|
|\
| |
| | |
Simplify and alias ActiveModel::Errors methods where possible
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Rails 5.0 changes to ActiveModel::Errors include addition of `details`
that also accidentally changed the return value of `delete`. Since
there was no test for that behavior it went unnoticed. This commit
adds a test and fixes the regression.
Small improvements to comments have also been made. Since `get` is
getting deprecated it is better to use `[]` in other methods' code
examples. Also, in the module usage example, `def Person.method`
was replaced with a more commonly used `def self.method` code style.
|
| |
| |
| |
| |
| |
| | |
Deprecation messages in ActiveModel::Errors are using String#squish
from ActiveSupport but were not explicitly requiring it, causing failures
when used outside rails.
|
|\ \
| | |
| | | |
Move `UnknownAttributeError` to a more sane namespace
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The name `ActiveModel::AttributeAssignment::UnknownAttributeError` is
too implementation specific so let's move the constant directly under
the ActiveModel namespace.
Also since this constant used to be under the ActiveRecord namespace, to
make the upgrade path easier, let's avoid raising the former constant
when we deal with this error on the Active Record side.
|
|/ /
| |
| |
| | |
parts out of active_support.
|
|/
|
|
| |
ActiveModel::Errors
|
|\
| |
| |
| | |
Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methods
|
|/
|
|
| |
without replacement.
|
|
|
|
| |
They have inconsistent behaviour currently.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To be able to return type of validator, one can now call `details`
on Errors instance:
```ruby
class User < ActiveRecord::Base
validates :name, presence: true
end
```
```ruby
user = User.new; user.valid?; user.errors.details
=> {name: [{error: :blank}]}
```
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default value for the argument `message` in
`ActiveModel::Errors#add` has a new behavior
since ca99ab2481d44d67bc392d0ec1125ff1439e9f94.
Before
person.errors.add(:name, nil)
# => ["is invalid"]
After
person.errors.add(:name, nil)
# => [nil]
|
|
|
|
| |
Mirror Ruby's Hash#key?
|
|
|
|
|
| |
This way no new object allocation is taking place. Thanks @jeremy for
the suggestion!
|
|
|
|
|
|
|
|
| |
The functionality has not changed, but the code is more elegant by
using `reduce` instead of `each`.
This way no accumulator needs to be declared, no explicit return is
needed.
|
|\
| |
| |
| | |
Use #model_name on instances instead of classes
|
| |
| |
| |
| |
| |
| | |
This allows rails code to be more confdent when asking for a model name, instead of having to ask for the class.
Rails core discussion here: https://groups.google.com/forum/#!topic/rubyonrails-core/ThSaXw9y1F8
|
|/ |
|
|
|
| |
[ci skip]
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
I also attempted to fix other styleguide violations such as
{ a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
|
|
|
|
| |
Add a working example of how to use this new method.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
right place.
The EachValidator#validate already handle :allow_blank and :allow_nil,
correctly.
Closes #8622.
Fix #8621.
|
|
|
|
|
| |
Conflicts:
activemodel/lib/active_model/errors.rb
|
|
|
|
|
|
|
|
| |
We don't need to define a new method in ActiveMode::Errors for each
validatior.
See
https://github.com/rails/rails/commit/d72a07f1d1478db9daed847eadb35bfd840674f6#commitcomment-2325333
|
|
|
|
|
|
| |
absence of attributes.
Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
|
|
|
|
|
|
|
|
|
|
| |
Sometimes, on Mac OS X, programmers accidentally press Option+Space
rather than just Space and don’t see the difference. The problem is
that Option+Space writes a non-breaking space (0XA0) rather than a
normal space (0x20).
This commit removes all the non-breaking spaces inadvertently
introduced in the comments of the code.
|
|
|
|
|
| |
* move ActiveModel::Errors tests to errors_test.rb
* add spec coverage for add_on_empty and add_on_blank
|
| |
|
| |
|
| |
|
| |
|