| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
`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.
|
|
|
|
|
|
|
|
| |
See:
- https://github.com/codahale/bcrypt-ruby/pull/63
- https://github.com/codahale/bcrypt-ruby/pull/64
- https://github.com/codahale/bcrypt-ruby/pull/65
|
|\
| |
| |
| |
| |
| |
| | |
Updated DirtyModel's @changed_attributes hash to be symbol/string agnostic
Conflicts:
activemodel/CHANGELOG.md
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
of an instance. When using the attribute_will_change! method, you must
supply a string and not a symbol or the *_changed? method will break
(because it is looking for the attribute name as a string in the keys
of the underlying hash). To remedy this, I simply made the underlying
hash a HashWithIndifferentAccess so it won't matter if you supply
the attribute name as a symbol or string to attribute_will_change!.
|
| |
| |
| |
| | |
[ci skip]
|
| |
| |
| |
| | |
Make AM::Dirty less dirty to plugin into AR or other library
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
chuckbergeron/validates-inclusion-of-accuracy-for-non-numeric-ranges
Greater accuracy for validates_inclusion_of on non-numeric ranges
Closes #10774, fixes #10593
|
| | |
| | |
| | |
| | |
| | |
| | | |
Range#include? for non-numeric ranges
added changelog message
|
|/ /
| |
| |
| | |
If the confirmation was blank, but the password wasn't, it would still save.
|
| |
| |
| |
| | |
their setup in their constructor now.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Add a working example of how to use this new method.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| | |
it only cleared the validations that created :validate callbacks. This
didn't include the validates created by validates_with, so I've added a
method to clear all validations.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Closes #9535.
With 692b3b6 the `password=` setter does no longer set blank passwords.
This triggered validation errors when assigning empty Strings to `password`
and `password_confirmation`.
This patch only sets the confirmation if it is not `blank?`.
|
| | |
|