Ruby on Rails Monday, October 24, 2016

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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/80430905-55c8-4123-a707-227362dcb2fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment