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 8a53e04
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,43 @@ class UsersController < ApplicationController
end
----

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

Order controller filter declarations in the order in which they will be executed.

[source,ruby]
----
# bad
class UsersController < ApplicationController
after_action :after_action_filter
around_action :around_action_filter1
before_action :before_action_filter1
prepend_around_action :prepend_around_action_filter
prepend_after_action :prepend_after_action_filter
append_around_action :append_around_action_filter
append_before_action :append_before_action_filter
around_action :around_action_filter2
prepend_before_action :prepend_before_action_filter
append_after_action :append_after_action_filter
before_action :before_action_filter2
end
# good
class UsersController < ApplicationController
before_action :before_action_filter1
before_action :before_action_filter2
around_action :around_action_filter1
around_action :around_action_filter2
after_action :after_action_filter
append_before_action :append_before_action_filter
append_around_action :append_around_action_filter
append_after_action :append_after_action_filter
prepend_before_action :prepend_before_action_filter
prepend_around_action :prepend_around_action_filter
prepend_after_action :prepend_after_action_filter
end
----

== Controllers: Rendering [[rendering]]

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

0 comments on commit 8a53e04

Please sign in to comment.