| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| | |
Moved database-specific ActiveModel types into ActiveRecord
|
| |
| |
| |
| | |
ie. DecimalWithoutScale, Text and UnsignedInteger
|
|/
|
|
|
|
| |
`#[]` 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`.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
`validates_acceptance_of` [ci skip]
- Improve CHANGELOG entry for #18439.
- The documentation is updated as per changes in PR #18439 to the
`accept` option.
- The explanation about the virtual attribute is moved at the end so
that the arity of `accept` option is explained first.
- Added a note that `message` can also be passed to `validates_acceptance_of`.
|
| |
|
|
|
|
|
|
|
|
|
| |
- 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]
|
|
|
|
| |
Adds changelog headers for beta3 release
|
| |
|
|
|
|
|
|
|
|
| |
While the type definition is in Active Model the change of behavior will
be only user facing in Active Record so better to put the entry in its
changelog.
[ci skip]
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During the `5.0.0.beta1` release, the CHANGELOGs got an entry like the
following:
```
* No changes.
```
It is kinda confusing as there are indeed changes after it. Not a
biggie, just a small pass over the CHANGELOGs.
[ci skip]
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
Move from `AS::Callbacks::CallbackChain.halt_and_display_warning_on_return_false`
to `AS::Callbacks.halt_and_display_warning_on_return_false` base on
[this
discussion](https://github.com/rails/rails/pull/21218#discussion_r39354580)
Fix the documentation broken by 0a120a818d413c64ff9867125f0b03788fc306f8
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Example:
```ruby
class Person
include ActiveModel::Validations
attr_reader :name, :title
validates_presence_of :name, on: :create
validates_presence_of :title, on: :update
end
person = Person.new
person.valid?([:create, :update]) # => true
person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]}
```
|
|
|
|
|
|
|
|
|
| |
dmitry/feature/validate-multiple-contexts-at-once"
This reverts commit 51dd2588433457960cca592d5b5dac6e0537feac, reversing
changes made to ecb4e4b21b3222b823fa24d4a0598b1f2f63ecfb.
This broke Active Record tests
|
|\
| |
| |
| | |
Validate multiple contexts on `valid?` and `invalid?` at once
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Example:
```ruby
class Person
include ActiveModel::Validations
attr_reader :name, :title
validates_presence_of :name, on: :create
validates_presence_of :title, on: :update
end
person = Person.new
person.valid?([:create, :update]) # => true
person.errors.messages # => {:name=>["can't be blank"], :title=>["can't be blank"]}
```
|
|\ \
| | |
| | |
| | | |
Add case_sensitive option for confirmation validation
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Case :- 1. In case of email confirmation one needs case insensitive comparison
2. In case of password confirmation one needs case sensitive comparison
[ci skip] Update Guides for case_sensitive option in confirmation validation
|
| |/
|/|
| |
| |
| |
| |
| | |
This includes the following classes:
- ActiveModel::Serializers::Xml
- ActiveRecord::Serialization::XmlSerializer
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
spelling fix [ci skip]
example to be consistent [ci skip]
grammatical fix
typo fixes [ci skip]
|
| |
| |
| |
| | |
`ActiveModel::Serialization#serializable_hash`
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
`ActiveModel::Dirty#[attr_name]_previous_change` to improve access
to recorded changes after the model has been saved.
It makes the dirty-attributes query methods consistent before and after
saving.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
As demonstrated by #19570, this option is severely limited, and
satisfies an extremely specific use case. Realistically, there's not
much reason for this option to exist. Its functionality can be trivially
replicated with a normal Ruby method. Let's deprecate this option, in
favor of the simpler solution.
|
| | |
|
| |
| |
| |
| | |
without replacement.
|
|\ \
| | |
| | |
| | | |
Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.
|
| | |
| | |
| | |
| | | |
They have inconsistent behaviour currently.
|
|\ \ \
| | | |
| | | |
| | | | |
Allow symbol as values for `tokenizer` of `LengthValidator`
|
| | | | |
|
| |/ /
|/| |
| | |
| | |
| | | |
The new association error belongs to Active Record, not Active Model.
See #18700 for reference.
|
|\ \ \
| | | |
| | | | |
Provide a better error message on :required association
|
| | | |
| | | |
| | | |
| | | | |
Fixes #18696.
|
|/ / / |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
Minor style changes across the board. Changed an alias to an explicit
method declaration, since the alias will not be documented otherwise.
|
| | |
| | |
| | |
| | |
| | |
| | | |
`ActiveModel::AttributesAssignment`
Allows to use it for any object as an includable module.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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}]}
```
|
| | | |
|
| | |
| | |
| | |
| | | |
`ActiveModel::Dirty#reset_changes`.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This stems from [a comment](rails#17227 (comment)) by @dhh.
In summary:
* New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning.
* Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning.
For this purpose, this commit introduces a Rails configuration option:
```ruby
config.active_support.halt_callback_chains_on_return_false
```
For new Rails 5.0 apps, this option will be set to `false` by a new initializer
`config/initializers/callback_terminator.rb`:
```ruby
Rails.application.config.active_support.halt_callback_chains_on_return_false = false
```
For existing apps ported to Rails 5.0, the initializers above will not exist.
Even running `rake rails:update` will not create this initializer.
Since the default value of `halt_callback_chains_on_return_false` is set to
`true`, these apps will still accept `return true` as a way to halt callback
chains, displaying a deprecation warning.
Developers will be able to switch to the new behavior (and stop the warning)
by manually adding the line above to their `config/application.rb`.
A gist with the suggested release notes to add to Rails 5.0 after this
commit is available at https://gist.github.com/claudiob/614c59409fb7d11f2931
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Before this commit, returning `false` in an ActiveModel `before_` callback
such as `before_create` would halt the callback chain.
After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.
The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
|