aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/callbacks.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add cancellation info to before filter docsZachary Wasserman2018-03-141-0/+12
| | | | | | | | | It is important for users to know that a render or redirect in a "before" filter causes the action to be cancelled. This was addressed in the guide, but not the API docs (http://guides.rubyonrails.org/action_controller_overview.html#filters). [ci skip]
* Replace unnecessary link with typewriter text [ci skip]Yoshiyuki Hirano2017-09-021-2/+2
|
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-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
|
* Remove useless class checking for `ActiveSupport::Callbacks`s result_lambdafatkodima2017-06-271-1/+1
|
* Improving docs for callbacks execution order [ci skip]dixpac2017-05-211-0/+20
| | | | | When define callbacks latest definition on the same callback/method overwrites previous ones.
* Remove deprecated methods related to controller filtersRafael Mendonça França2016-10-091-39/+0
| | | | | | | | | | `skip_action_callback`, `skip_filter`, `before_filter`, `prepend_before_filter`, `skip_before_filter`, `append_before_filter`, `around_filter` `prepend_around_filter`, `skip_around_filter`, `append_around_filter`, `after_filter`, `prepend_after_filter`, `skip_after_filter` and `append_after_filter`.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* modernizes hash syntax in actionpackXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionpack/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.
* Use `#performed?` to terminate controller callbacksJeff Kreeftmeijer2016-06-031-1/+1
| | | | | | | | | | | | | | | Since 69009f, `ActionController::Metal::DataStreaming#send_file` doesn't set `@_response_body` anymore. `AbstractController::Callbacks` used `@_response_body` in its callback terminator, so it failed to halt the callback cycle when using `#send_file` from a `before_action`. Instead, it now uses `#performed?` on `AbstractController::Base` and `ActionController::Metal`, which checks `response.committed?`, besides checking if `@_response_body` is set, if possible. Example application: https://gist.github.com/jeffkreeftmeijer/78ae4572f36b198e729724b0cf79ef8e
* Deprecate passing string to define callback.yui-knk2015-12-161-1/+2
|
* adding missing `.` Gaurav Sharma2015-11-151-5/+5
|
* specify deprecated waring, follow the standard conventionsGaurav Sharma2015-10-281-1/+1
| | | | `skip_filter`, `skip_action_callback` may both are deprecated in Rails 5.1 so waring msg should be specific.
* Raise ArgumentError if an unrecognised callback is skippedIain Beeston2015-04-031-3/+3
| | | | | | | | | | | | | | At present, if you skip a callback that hasn't been defined, activesupport callbacks silently does nothing. However, it's easy to mistype the name of a callback and mistakenly think that it's being skipped, when it is not. This problem even exists in the current test suite. CallbacksTest::SkipCallbacksTest#test_skip_person attempts to skip callbacks that were never set up. This PR changes `skip_callback` to raise an `ArgumentError` if the specified callback cannot be found.
* Removed non-standard and unused require 'active_support/deprecation' from ↵Vipul A M2015-02-271-2/+0
| | | | parts out of active_support.
* fix NameError in `skip_filter`. callback doesn't exist.yuuji.yaginuma2015-02-271-1/+1
|
* Deprecate `AbstractController::Callbacks#skip_action_callback`Iain Beeston2015-02-241-0/+1
| | | | | | | | | | As part of #19029, in future `skip_before_action`, `skip_after_action` and `skip_around_action` will raise an ArgumentError if the specified callback does not exist. `skip_action_callback` calls all three of these methods and will almost certainly result in an ArgumentError. If anyone wants to remove all three callbacks then they can still call the three individual methods. Therefore let's deprecate `skip_action_callback` now and remove it when #19029 is merged.
* fix typo in `_filter` deprecation message. [ci skip]Yves Senn2015-01-301-5/+5
|
* Deprecate all *_filter callbacks in favor of *_action callbacksAbdelkader Boudih2015-01-081-5/+27
|
* Add test/doc for :if/:except in skip_before_actionclaudiob2015-01-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | The new test/docs further explain the conflicts that can happen when mixing `:if`/`:unless` options with `:only`/`:except` options in `skip_before_action`. The gist is that "positive" filters always have priority over negative ones. The previous commit already showed that `:only` has priority over `:if`. This commit shows that `:if` has priority over `:except`. For instance, the following snippets are equivalent: ```ruby skip_before_action :some_callback, if: -> { condition }, except: action ``` ```ruby skip_before_action :some_callback, if: -> { condition } ```
* Add test case and documentation for skip_before_filter.Lauro Caetano2015-01-081-0/+5
| | | | | | | | Test case for using skip_before_filter with the options :only and :if both present. In this case, the :if option will be ignored and :only will be executed. Closes #14549 (the commit was cherry-picked from there).
* Merge pull request #17227 from claudiob/explicitly-abort-callbacksRafael Mendonça França2015-01-031-1/+1
|\ | | | | | | | | | | | | Introduce explicit way of halting callback chains by throwing :abort. Deprecate current implicit behavior of halting callback chains by returning `false` in apps ported to Rails 5.0. Completely remove that behavior in brand new Rails 5.0 apps. Conflicts: railties/CHANGELOG.md
| * 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`.
* | Better docs for AbstractControllerclaudiob2014-12-221-4/+5
|/ | | | | | Fixes internal links, adds examples and set fixed-width fonts. [ci skip]
* Partially revert deprecation of *_filterRafael Mendonça França2014-06-031-27/+6
| | | | | | | | | | | We are going to deprecate only on Rails 5 to make easier plugin maintainers support different Rails versions. Right now we are only discouraging their usage. This reverts commit 6c5f43bab8206747a8591435b2aa0ff7051ad3de. Conflicts: actionpack/CHANGELOG.md
* Deprecate all *_filter callbacks in favor of *_action callbacksRafael Mendonça França2014-05-271-20/+24
| | | | | This is the continuation of the work started at 9d62e04838f01f5589fa50b0baa480d60c815e2c
* replace class_eval by define_method in abstract_controller/callbackskirill2014-04-201-35/+29
|
* Execute conditional procs on controller filters only for current action.Nicholas Jakobsen2013-08-101-1/+1
| | | | | | :only and :except options for controller filters are now added before :if and :unless. This prevents running :if and :unless procs when not on the specified. Closes #11786.
* use extract_options!Neeraj Singh2013-07-021-1/+1
|
* deprecating string based terminatorsAaron Patterson2013-05-141-1/+3
|
* fix prepend_before_filter documentation [ci skip]Francesco Rodriguez2012-12-071-3/+3
|
* Rename all action callbacks from *_filter to *_actionDavid Heinemeier Hansson2012-12-071-64/+86
|
* Removing duplication in callback normalization.Steve Klabnik2012-11-091-7/+8
| | | | These two things were 100% identical.
* removing key argument from run_callbacks - fix buildFrancesco Rodriguez2012-05-101-1/+1
|
* Improve readability of metaprogramming annotations at AbstractController ↵Edward Tsech2012-05-081-10/+10
| | | | callbacks.
* Remove skip_filter block paramAlexey Vakhov2012-02-231-7/+7
|
* Merge pull request #4866 from bogdan/terminate_after_callbacksJosé Valim2012-02-041-3/+1
|\ | | | | AS::Callbacks#define_callbacks: add :terminate_after_callbacks option
| * AS::Callbacks: :skip_after_callbacks_if_terminated optionBogdan Gusiev2012-02-031-3/+1
| |
* | AC::Callbacks: remove usage of :per_key option from filtersBogdan Gusiev2012-02-031-6/+4
|/
* Array.wrap is no longer needed in AbstractController::CallbacksRafael Mendonça França2012-01-051-2/+2
|
* Fix comment in AbstractController callbacksAlexey Vakhov2011-10-061-2/+2
|
* update abstract_controller callbacks to document meta-programmed filtersgeemus2011-08-131-18/+102
|
* Revert to old semantics, use available_action? instead of action_method?.José Valim2011-05-061-2/+2
|
* Added missing </tt>Oge Nnadi2011-04-111-1/+1
|
* Pass the proper method_name instead of hardcoding to action_name.José Valim2011-03-291-1/+1
| | | | | | Conflicts: actionpack/lib/action_controller/metal/implicit_render.rb
* Fix filter :only and :except with implicit actionsAndrew White2011-03-231-1/+1
| | | | | | | The method_name argument is "default_render" for implicit actions so use the action_name attribute to determine which callbacks to run. [#5673 state:resolved]
* process_action accepts multiple args, even with Callbacks.Nick Sutterer2010-12-291-1/+1
|
* Remove inline comment.José Valim2010-11-111-17/+17
|