is order of execution of append before action filters same as their order of appearance in the source?

11 views
Skip to first unread message

Nilesh More

unread,
Oct 24, 2016, 8:12:14 PM10/24/16
to Ruby on Rails: Core
Does rails guarantee that the order of execution of multiple append_action_filters is same as the order in which these filters appear in the source file? For example,
I have a rails controller problems_controller.rb, a snippet from which is copied below.

append_before_action :force_sign_out_if_token_about_to_expire,  
only: [:get_create_problem_page, 
       :get_create_problem_page_v2,
       :get_solve_problem_page]

append_before_action :require_signed_in_user,  
only [:get_create_problem_page,  
      :get_create_problem_page_v2,  
      :get_solve_problem_page]  

By using print statements, I can see that for all three actions listed above, force_sign_out_if_token_about_to_expire is executed before require_signed_in_user. But I couldn't find rails documentation which supports this observation. Though I could find documentation for filter chain ordering here , for my application I would prefer to use the filters in the style listed above. Also, there is a problem I am facing if I try using the filters as stated in documentation. I can elaborate on that if required.

Thank you in advance,
Nilesh
Reply all
Reply to author
Forward
0 new messages