Skip to content

Commit 8a53e04

Browse files
committed
Add Action Filters Order section
1 parent 2e7d125 commit 8a53e04

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.adoc

+37
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,43 @@ class UsersController < ApplicationController
266266
end
267267
----
268268

269+
=== Action Filters Order [[action-filters-order]]
270+
271+
Order controller filter declarations in the order in which they will be executed.
272+
273+
[source,ruby]
274+
----
275+
# bad
276+
class UsersController < ApplicationController
277+
after_action :after_action_filter
278+
around_action :around_action_filter1
279+
before_action :before_action_filter1
280+
prepend_around_action :prepend_around_action_filter
281+
prepend_after_action :prepend_after_action_filter
282+
append_around_action :append_around_action_filter
283+
append_before_action :append_before_action_filter
284+
around_action :around_action_filter2
285+
prepend_before_action :prepend_before_action_filter
286+
append_after_action :append_after_action_filter
287+
before_action :before_action_filter2
288+
end
289+
290+
# good
291+
class UsersController < ApplicationController
292+
before_action :before_action_filter1
293+
before_action :before_action_filter2
294+
around_action :around_action_filter1
295+
around_action :around_action_filter2
296+
after_action :after_action_filter
297+
append_before_action :append_before_action_filter
298+
append_around_action :append_around_action_filter
299+
append_after_action :append_after_action_filter
300+
prepend_before_action :prepend_before_action_filter
301+
prepend_around_action :prepend_around_action_filter
302+
prepend_after_action :prepend_after_action_filter
303+
end
304+
----
305+
269306
== Controllers: Rendering [[rendering]]
270307

271308
=== Inline Rendering [[inline-rendering]]

0 commit comments

Comments
 (0)