Skip to content

Commit

Permalink
Add Action Filters Order section
Browse files Browse the repository at this point in the history
  • Loading branch information
ydakuka committed Dec 11, 2023
1 parent 2e7d125 commit 87c18a5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,28 @@ class UsersController < ApplicationController
end
----

=== Action Filters Order [[action-filters-order]]

Order controller filter declarations in the order in which they will be executed.
For reference, see https://dev.to/timkrins/an-experiment-with-controller-action-callbacks-in-rails-c3p[An experiment with controller action callback order in Rails].

[source,ruby]
----
# bad
class UsersController < ApplicationController
after_action :after_action_filter
prepend_around_action :prepend_around_action_filter
before_action :before_action_filter
end
# good
class UsersController < ApplicationController
before_action :before_action_filter
after_action :after_action_filter
prepend_around_action :prepend_around_action_filter
end
----

== Controllers: Rendering [[rendering]]

=== Inline Rendering [[inline-rendering]]
Expand Down

0 comments on commit 87c18a5

Please sign in to comment.