Suppose we have an action in the controller where very important to me as soon as you generate the view, which is divided into the part where we generate the view for the user and the part that processes certain information, but has no relation with a view. I do not want to use delayed because processing it’s about 2-3 queries to the database. Do you use the after_filter after this action will bring the desired effect, shorten the time of final render view for the user?
Share
before_around_andafter_filters all execute before any view code is actually rendered to the user. Therefore any processing that takes place in one of these callbacks will have the same perceived time to the user. If this processing part you’re referring to is taking a long time, you might want to consider having it run with an AJAX request after the page loads, using a background job (as you mentioned) or optimizing the code so it doesn’t take as long.