| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
Make sure how to abort is documented on https://api.rubyonrails.org/classes/ActiveSupport/Callbacks.html
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use attr_reader/attr_writer instead of methods
method is 12% slower
Use flat_map over map.flatten(1)
flatten is 66% slower
Use hash[]= instead of hash.merge! with single arguments
merge! is 166% slower
See https://github.com/rails/rails/pull/32337 for more conversation
|
|\
| |
| | |
Define callbacks on descendants.
|
| |
| |
| |
| | |
Addresses feedback from https://github.com/rails/rails/pull/31913#issuecomment-365983580
|
| |
| |
| |
| | |
We set callbacks on all descendants, so we need to make sure that they are also defined on all descendants as well.
|
|/
|
|
|
| |
Now we always have a terminator, so we don't need to day the options
only make sense when the `:terminator` options is specified.
|
| |
|
|
|
|
| |
This basically reverts 8da30ad6be34339124ba4cb4e36aea260dda12bc
|
| |
|
| |
|
| |
|
|\
| |
| | |
Remove useless class checking for `ActiveSupport::Callbacks`s result_lambda
|
| | |
|
| | |
|
|/
|
|
| |
This deprecation warning message will be more useful if it indicates what the string was doing — being eval'd — and what the non-deprecated options for callback conditionals are.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Allow a default value to be declared for class_attribute
* Convert to using class_attribute default rather than explicit setter
* Removed instance_accessor option by mistake
* False is a valid default value
* Documentation
|
|
|
| |
Since 3aee9126aa6309538ee64064dcabcd34d7cc7d26, this class hasn't inherited from Array.
|
|
|
|
| |
https://github.com/rails/rails/commit/9e98f3f7e61dfce0a48948c8d296400af8bfaf21#diff-1ecd313ff0ab827af30014553cf8918dL76
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`halt_and_display_warning_on_return_false`
`halt_and_display_warning_on_return_false` is not a public API and
application is using `halt_callback_chains_on_return_false`.
https://github.com/rails/rails/blob/5-0-stable/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt#L29
https://github.com/rails/rails/blob/5-0-stable/activesupport/lib/active_support.rb#L86..L88
Therefore, deprecate messages should be issued for
`halt_callback_chains_on_return_false` instead of
`halt_and_display_warning_on_return_false`.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
`set_callback` and `skip_callback`
|
|
|
|
| |
And raise `ArgumentError` when passing string to define callback.
|
|
|
|
|
|
|
| |
It's questionable whether this is a good thing -- it forces any later/
inner callback to handle multiple invocations, along with the actual
wrapped action. But it worked prior to 871ca21f6a1d65c0ec78cb5a9641411e2210460b,
so we shouldn't break it unintentionally.
|
| |
|
|
|
|
| |
See #26854
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In https://bugs.ruby-lang.org/issues/12860 I argue that MRI's
execution order here is incorrect. The splatting of the 'c' args
should happen before the shift, but it happens after. On JRuby, it
behaves the way you would expect, leading to the 'c' args splat
still containing the block and producing an error like "cannot
convert proc to symbol" when the send attempts to coerce
it.
This patch makes the unpacking order explicit with a multi-assign,
which behaves properly on all implementations I tested.
|
|
|
|
|
|
|
|
|
|
| |
Callbacks are everywhere, so it's better if we can avoid making a mess
of the backtrace just because we've passed through a callback hook.
I'm making no effort to the before/after invocations: those only affect
backtraces while they're running. The calls that matter are the ones
that remain on the call stack after run_callbacks yields: around
callbacks, and internal book-keeping around the before/afters.
|
|
|
|
| |
Single backticks don't work with rdoc.
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But comments was still kept absolute position. This commit aligns
comments with method definitions for consistency.
|
|
|
|
|
|
| |
All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772.
But heredocs was still kept absolute position. This commit aligns
heredocs indentation for consistency.
|
|
|
|
|
|
|
|
| |
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces
Fix all violations in the repository.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
- Also added a note when calling multiple time `define_callbacks`
|
| |
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
|
|
| |
Instance level writers can have an impact on how the Active Model /
Record objects are saved. Specifically, they can be used to bypass
validations. This is a problem if mass assignment protection is
disabled and specific attributes are passed to the constructor.
CVE-2016-0753
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Rails 4.2.3 AS::Callbacks will not halt chain if `false` is returned.
That is the behavior of specific callbacks like AR::Callbacks and
AM::Callbacks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes #21122 - does not change any current behavior; simply reflects
the fact that two conditions of the if/else statement are never reached.
The reason is #17227 which adds a default terminator to AS::Callbacks.
Therefore, even callback chains that do not define a terminator now
have a terminator, and `chain_config.key?(:terminator)` is always true.
Of course, if no terminator was defined, then we want this new default
terminator not to do anything special. What the terminator actually does
(or should do) is discussed in #21218 but the simple fact that a default
terminator exists makes this current PR valid.
*Note* that the conditional/simple methods have not been removed in
AS::Conditionals::Filter::After because of `:skip_after_callbacks_if_terminated`
which lets a user decide **not** to skip after callbacks even if the chain was
terminated.
|
|
|
|
|
|
|
| |
The second argument of the terminator lambda is no longer the result
of the callback, but the result lambda.
https://github.com/rails/rails/blob/3a7609e2bafee4b071fe35136274e6ccbae8cacd/activesupport/test/callbacks_test.rb#L553
|