| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
`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)`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before this commit, returning `false` in an ActiveModel validation
callback such as `before_validation` 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)`.
|
| |
| |
| |
| |
| |
| |
| | |
We will support only Ruby >= 2.1.
But right now we don't accept pull requests with syntax changes to drop
support to Ruby 1.9.
|
| | |
|
| | |
|
|/ |
|
|\
| |
| |
| | |
Check for valid options in validate method
|
|/
|
|
|
|
|
|
|
|
|
| |
This change prevents a certain class of user error which results when
mistakenly using the `validate` class method instead of the `validates`
class method.
Only apply when all arguments are symbols, because some validations use
the `validate` method and pass in additional options, namely the
`LenghValidator` via the `ActiveMode::Validations::validates_with`
method.
|
|
|
|
|
|
|
|
|
| |
These methods may cause confusion with the `reset_changes` that
behaves differently
of them.
Also rename undo_changes to restore_changes to match this new set of
methods.
|
|
|
|
|
|
|
|
|
| |
#clear_changes_information
This method name is causing confusion with the `reset_#{attribute}`
methods. While `reset_name` set the value of the name attribute for the
previous value the `reset_changes` only discard the changes and previous
changes.
|
|
|
|
| |
To avoid overload with database rollback
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| |
| | |
add missing changelog entry. refer [#16db90d] [ci skip]
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Remove 4-1 related entries from master [ci skip]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The documentation of `#to_key` (http://api.rubyonrails.org/classes/ActiveModel/Conversion.html#method-i-to_key)
states that it returns `nil` if there are no key attributes. `to_param` needs
to be aware of that fact and return `nil` as well.
Previously it raised the following exception:
```
1) Error:
ConversionTest#test_to_param_returns_nil_if_to_key_is_nil:
NoMethodError: undefined method `join' for nil:NilClass
/Users/senny/Projects/rails/activemodel/lib/active_model/conversion.rb:65:in `to_param'
/Users/senny/Projects/rails/activemodel/test/cases/conversion_test.rb:34:in `block in <class:ConversionTest>'
```
|
| |
|
|
|
|
|
|
| |
Example:
validates_presence_of :name, on: [:update, :custom_validation_context]
|
|
|
|
|
| |
Also improve changelog entries related to secure password to proper
highlight.
|
|
|
|
| |
model.name_changed?(from: "Pete", to: "Ringo")
|
|
|
|
|
|
|
|
|
|
|
|
| |
Extract **notable changes**, **deprecations** and **removals** from
each CHANGELOG.
I tried to reference the commits and pull requests for new features
and deprecations.
In the process I also made some minor changes to the CHANGELOGS.
The 4_1_release_notes guide is declared WIP.
|