# Pre-processing for every page

**URL:** <https://www.ruby-forum.com/t/pre-processing-for-every-page/117119>\
**Category:** Rails\
**Created:** [October 13, 2007, 6:42am UTC](https://www.ruby-forum.com/t/pre-processing-for-every-page/117119 "2007-10-13T06:42:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [October 13, 2007, 6:42am UTC](https://www.ruby-forum.com/t/pre-processing-for-every-page/117119/1 "2007-10-13T06:42:51Z")

</div>

In my own app framework I’ve used for some time now, I am accustomed  
to having code which is processed for every page request prior to the  
page/request-specific code.

In Rails, I’m still fguring out the flow of execution, and I can’t  
see where that code would go. The controller before\_filter is nifty,  
but what I am talking about would require redundant before\_filters  
for virtually every controller.

This code needs to run with the ability to dissect the request URL to  
perform ops conditional to the URL content, then proceed with the  
standard Rails controller/action hierarchy.

Where in Rails is there a point that I can tap into for this type of  
thing?

TIA.

– gw

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [October 13, 2007, 6:54am UTC](https://www.ruby-forum.com/t/pre-processing-for-every-page/117119/2 "2007-10-13T06:54:32Z")

</div>

On Oct 12, 2007, at 23:41 , Greg W. wrote:

> In Rails, I’m still fguring out the flow of execution, and I can’t  
> see where that code would go. The controller before\_filter is nifty,  
> but what I am talking about would require redundant before\_filters  
> for virtually every controller.

Per the comment before ApplicationController (app/controllers/  
application.rb):

# Filters added to this controller apply to all controllers in the

application.

# Likewise, all the methods added will be available for all controllers.

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [October 13, 2007, 7:05am UTC](https://www.ruby-forum.com/t/pre-processing-for-every-page/117119/3 "2007-10-13T07:05:38Z")

</div>

On Oct 12, 2007, at 9:53 PM, Michael G. wrote:

> # Filters added to this controller apply to all controllers in the
> 
> application.
> 
> # Likewise, all the methods added will be available for all
> 
> controllers.

Ahh… yep. Didn’t see that one. Thanks!

– gw
