# Building a "between filter"? Any ideas welcome

**URL:** <https://www.ruby-forum.com/t/building-a-between-filter-any-ideas-welcome/91504>\
**Category:** Rails\
**Created:** [April 9, 2007, 10:54pm UTC](https://www.ruby-forum.com/t/building-a-between-filter-any-ideas-welcome/91504 "2007-04-09T22:54:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjmadsen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b3f665/32.png) [@sjmadsen](https://www.ruby-forum.com/u/sjmadsen)\
**Post date:** [April 9, 2007, 10:54pm UTC](https://www.ruby-forum.com/t/building-a-between-filter-any-ideas-welcome/91504/1 "2007-04-09T22:54:48Z")

</div>

Hi,

I’m sure there’s a good way to solve this problem and I’m hoping for  
some insight into the best approach.

I’d like to be able to fire a “filter” event off _between_ the action  
and the view. Right now, as I understand it, filters work like so:

BEFORE FILTERS RUN  
ACTION RUNS  
VIEW PROCESSING OCCURS (several steps)  
AFTER FILTERS RUN

I’d like to find a way to add additional events so that:

BEFORE FILTERS RUN  
ACTION RUNS  
==\> “BETWEEN FILTERS” run  
VIEW PROCESSING OCCURS (several steps)  
AFTER FILTERS RUN

Does anyone have any ideas? Maybe there’s a major architectural reason  
why this is a Bad Idea, but I’d like it for setting up generic view-  
related state data that depends on the results of the action. For  
example, let’s say I want to create some meta-tags that have some  
dependency on business logic and processing that occurs in the action.  
I’d like to construct an array of meta-tag elements in the “between  
filter” and make them available to every view in that controller.

Right now, I’m putting a “generate\_meta\_tags” method at the end of  
every action, but that doesn’t seem like the “Rails way.” Any  
suggestions are welcome, and apologies if this is a bone-headed  
question to which any moron would already know the answer! : )

Steve
