From 30433253eda59656b1060d6ccc5e1b8e5913c331 Mon Sep 17 00:00:00 2001 From: Kirill Zhuravlov Date: Wed, 23 Nov 2016 03:04:55 +0200 Subject: Add link to API documentation Add a link to http://api.rubyonrails.org/classes/ActionController.html in the beginning of an article. --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/action_controller_overview.md') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 40eb838d32..69c4a00c5f 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -61,7 +61,7 @@ end The [Layouts & Rendering Guide](layouts_and_rendering.html) explains this in more detail. -`ApplicationController` inherits from `ActionController::Base`, which defines a number of helpful methods. This guide will cover some of these, but if you're curious to see what's in there, you can see all of them in the API documentation or in the source itself. +`ApplicationController` inherits from `ActionController::Base`, which defines a number of helpful methods. This guide will cover some of these, but if you're curious to see what's in there, you can see all of them in the [API documentation](http://api.rubyonrails.org/classes/ActionController.html) or in the source itself. Only public methods are callable as actions. It is a best practice to lower the visibility of methods (with `private` or `protected`) which are not intended to be actions, like auxiliary methods or filters. -- cgit v1.2.3 From 2b3a3738b7a519f32f593f6e6b9c6ba89daa72ea Mon Sep 17 00:00:00 2001 From: Frederik Wille Date: Wed, 29 Mar 2017 15:46:10 +0200 Subject: add hint on after_action filters Adds a hint that ``after_action``-callbacks are not executed when an exception was raised in the rest of the request cycle. The ``before_action`` section mentions "If there are additional filters scheduled to run after that filter, they are also cancelled." but this is IMO not sufficient. --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/action_controller_overview.md') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 69c4a00c5f..a43a69b7a3 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -719,7 +719,7 @@ Now, the `LoginsController`'s `new` and `create` actions will work as before wit In addition to "before" filters, you can also run filters after an action has been executed, or both before and after. -"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. +"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. Please note that "after" filters are executed only after a successful action but not when an exception was raised in the request cycle. "around" filters are responsible for running their associated actions by yielding, similar to how Rack middlewares work. -- cgit v1.2.3 From f77a6be8d23f048ced4fac54f1f4caea5e0749d7 Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Wed, 29 Mar 2017 16:14:06 -0400 Subject: Small grammar fix Add comma and change verb. [ci skip] --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/action_controller_overview.md') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index a43a69b7a3..5d987264f5 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -719,7 +719,7 @@ Now, the `LoginsController`'s `new` and `create` actions will work as before wit In addition to "before" filters, you can also run filters after an action has been executed, or both before and after. -"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. Please note that "after" filters are executed only after a successful action but not when an exception was raised in the request cycle. +"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. Please note that "after" filters are executed only after a successful action, but not when an exception is raised in the request cycle. "around" filters are responsible for running their associated actions by yielding, similar to how Rack middlewares work. -- cgit v1.2.3 From 4f3955657736796664aa8d6f6d149ef9b213b058 Mon Sep 17 00:00:00 2001 From: dixpac Date: Sat, 13 May 2017 13:56:37 +0200 Subject: Improving docs for callbacks execution order [ci skip] When define callbacks latest definition on the same callback/method overwrites previous ones. --- guides/source/action_controller_overview.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'guides/source/action_controller_overview.md') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 5d987264f5..22537f960c 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -715,6 +715,9 @@ end Now, the `LoginsController`'s `new` and `create` actions will work as before without requiring the user to be logged in. The `:only` option is used to skip this filter only for these actions, and there is also an `:except` option which works the other way. These options can be used when adding filters too, so you can add a filter which only runs for selected actions in the first place. +NOTE: Calling the same filter multiple times with different options will not work, +since the last filter definition will overwrite the previous ones. + ### After Filters and Around Filters In addition to "before" filters, you can also run filters after an action has been executed, or both before and after. -- cgit v1.2.3 From 57add37382e7f9859f82eda9ddf90ca7704d0c2e Mon Sep 17 00:00:00 2001 From: Yuki Nishijima Date: Tue, 11 Jul 2017 12:54:12 -0400 Subject: Fix english for the rescue_from warning [ci skip] --- guides/source/action_controller_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guides/source/action_controller_overview.md') diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md index 22537f960c..7de6542f4a 100644 --- a/guides/source/action_controller_overview.md +++ b/guides/source/action_controller_overview.md @@ -1186,7 +1186,7 @@ class ClientsController < ApplicationController end ``` -WARNING: You shouldn't do `rescue_from Exception` or `rescue_from StandardError` unless you have a particular reason as it will cause serious side-effects (e.g. you won't be able to see exception details and tracebacks during development). +WARNING: Using `rescue_from` with `Exception` or `StandardError` would cause serious side-effects as it prevents Rails from handling exceptions properly. As such, it is not recommended to do so unless there is a strong reason. NOTE: When running in the production environment, all `ActiveRecord::RecordNotFound` errors render the 404 error page. Unless you need -- cgit v1.2.3