aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/callbacks.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Require hash/keys inside active_model/callbacksRafael Mendonça França2019-01-161-0/+1
| | | | | | | | | This file uses assert_valid_keys but it was not being required. You can reproduce this error with a script that uses this feature by using those requires: require 'active_model' require 'active_model/callbacks'
* Merge pull request #30919 from seanlinsley/17622-before_save_strict_argumentsRyuta Kamizono2018-07-231-7/+9
|\ | | | | | | Add strict argument checking to ActiveRecord callbacks
| * add strict argument checking to ActiveRecord callbacksSean Linsley2018-07-221-7/+9
|/ | | | This ends up adding it to all save-related callbacks defined in `ActiveRecord::DefineCallbacks`, including e.g. `after_create`. Which should be fine: they didn't support `:on` in the first place.
* Use tt in doc for ActiveRecord [ci skip]Yoshiyuki Hirano2017-08-271-2/+2
|
* Use frozen string literal in activemodel/Kir Shatrov2017-07-161-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Improving docs for callbacks execution order [ci skip]dixpac2017-05-211-0/+3
| | | | | When define callbacks latest definition on the same callback/method overwrites previous ones.
* Remove deprecated behavior that halts callbacks when the return is falseRafael Mendonça França2017-02-071-1/+0
|
* No need to :nodoc: private methodsAkira Matsuda2016-12-241-3/+3
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-18/+18
|
* applies new string literal convention in activemodel/libXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix the AS::Callbacks terminator regression from 4.2.3Roque Pinel2015-09-221-0/+1
| | | | | | 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.
* Fix description for AM::CallbacksVipul A M2015-01-311-1/+1
|
* Deprecate `false` as the way to halt AM callbacksclaudiob2015-01-021-2/+1
| | | | | | | | | | 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)`.
* Throw :abort halts default CallbackChainsclaudiob2015-01-021-1/+1
| | | | | | | | | | | | | | This commit changes arguments and default value of CallbackChain's :terminator option. After this commit, Chains of callbacks defined **without** an explicit `:terminator` option will be halted as soon as a `before_` callback throws `:abort`. Chains of callbacks defined **with** a `:terminator` option will maintain their existing behavior of halting as soon as a `before_` callback matches the terminator's expectation. For instance, ActiveModel's callbacks will still halt the chain when a `before_` callback returns `false`.
* fix typo in in define_model_callbacks comment [ci skip]Ryan Selk2014-10-031-1/+1
|
* add notes for `define_model_callbacks` [ci skip]Kuldeep Aggarwal2014-10-031-0/+3
|
* Fix few typos in the documentation [ci skip]Robin Dupret2013-12-211-1/+1
|
* remove some evals from callback conditionalsAaron Patterson2013-06-111-1/+4
|
* deprecating string based terminatorsAaron Patterson2013-05-141-1/+1
|
* Using define method instead of class eval when defining model callbacks.wangjohn2013-05-081-18/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on my benchmark results, this change improves performance substantially when defining callbacks. This benchmark (https://gist.github.com/wangjohn/5542610) was run using the current master and also using my experimental branch which replaced class_eval with define_single_method. Using class_eval (current master): user system total real 10 trials 0.000000 0.000000 0.000000 ( 0.001568) 50 trials 0.020000 0.000000 0.020000 ( 0.021715) 500 trials 0.110000 0.000000 0.110000 ( 0.115357) 1000 trials 0.250000 0.000000 0.250000 ( 0.260025) 10000 trials 2.560000 0.000000 2.560000 ( 2.568408) 50000 trials 12.800000 0.010000 12.810000 ( 12.886871) Using define_single_method (experimental branch): user system total real 10 trials 0.000000 0.000000 0.000000 ( 0.000790) 50 trials 0.000000 0.000000 0.000000 ( 0.002960) 500 trials 0.050000 0.010000 0.060000 ( 0.055690) 1000 trials 0.100000 0.000000 0.100000 ( 0.094073) 10000 trials 0.890000 0.000000 0.890000 ( 0.900364) 50000 trials 4.650000 0.000000 4.650000 ( 4.686127)
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-4/+4
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Missing require extract_optionsAkira Matsuda2013-01-311-0/+2
|
* cleanup, removed dispensable `require` statements from `ActiveModel`Yves Senn2012-11-251-2/+0
|
* minor edits in AM documentation [ci skip]Francesco Rodriguez2012-10-211-1/+1
|
* add around_create callback documentation for ActiveModel::Callbacksandrea longhi2012-08-081-0/+11
|
* Make internal callback model definitions private in AMoCarlos Antonio da Silva2012-06-251-5/+7
| | | | | | | These _define class methods don't need to be exposed to objects that extend ActiveModel::Callbacks. Also use merge! options to avoid the creation of an extra hash.
* add :nodoc: to internal implementations [ci skip]Francesco Rodriguez2012-06-221-1/+1
|
* update ActiveModel::Callbacks documentation [ci skip]Francesco Rodriguez2012-06-221-24/+26
|
* AS::Callbacks: :skip_after_callbacks_if_terminated optionBogdan Gusiev2012-02-031-1/+2
|
* Remove Array.wrap call in ActiveModelRafael Mendonça França2012-01-061-3/+2
|
* Log 'Filter chain halted as CALLBACKNAME rendered or redirected' every time ↵José Valim2011-11-301-1/+1
| | | | a before callback halts.
* Small docs fix in Active Model callbacks moduleAlexey Vakhov2011-11-191-1/+1
|
* Remove extra white spaces on ActiveModel docs.Sebastian Martinez2011-05-231-1/+1
|
* Use run_callbacks; the generated _run_<name>_callbacks method is not a ↵John Firebaugh2011-01-311-4/+1
| | | | | | public interface. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* No need to symbolize these.José Valim2010-12-271-1/+1
|
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-29/+29
| | | | 's/[ \t]*$//' -i {} \;)
* no callbacks should be created for empty array [#5289 state:resolved]Subba Rao Pasupuleti2010-08-121-3/+6
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* replacing around with for in the comments for callbacksNeeraj Singh2010-07-221-1/+1
|
* Changes call backs to callbacks.Rizwan Reza2010-06-151-8/+8
|
* Minor changes to active_model/callbacks.rb and dirty.rbRizwan Reza2010-06-141-1/+1
|
* Minor changes to callbacks and conversion API docs.Rizwan Reza2010-06-141-6/+6
|
* fix stack trace lines on class_evalSantiago Pastorino2010-04-091-3/+3
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Use Array.wrap uniformlyJeremy Kemper2010-03-271-3/+4
|
* ActiveModel::Callbacks documentationMikel Lindsaar2010-01-151-31/+73
|
* Move ActiveRecord callbacks implementation to ActiveModel and make use of it.José Valim2009-12-281-0/+91
| | | | Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
* Get rid of active_model/core and active_model/callbacksPratik Naik2009-03-211-7/+0
|
* initial statemachine machine and state classesrick2008-06-281-1/+1
|