# \<meta http-equiv="refresh" content="5"/\>

**URL:** <https://www.ruby-forum.com/t/meta-http-equiv-refresh-content-5/148468>\
**Category:** Rails\
**Created:** [September 13, 2008, 2:39am UTC](https://www.ruby-forum.com/t/meta-http-equiv-refresh-content-5/148468 "2008-09-13T02:39:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 13, 2008, 2:39am UTC](https://www.ruby-forum.com/t/meta-http-equiv-refresh-content-5/148468/1 "2008-09-13T02:39:15Z")

</div>

Do you know of any way for me to stick a meta tag in using a  
before\_filter or after\_filter or around\_filter?

I have been trying to figure out out and just cannot make sense of it.

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 14, 2008, 1:39am UTC](https://www.ruby-forum.com/t/meta-http-equiv-refresh-content-5/148468/2 "2008-09-14T01:39:06Z")

</div>

You could use the content\_for pattern. Set the header as he content in  
your filter, and output it in your view.

Christian

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [September 14, 2008, 2:09am UTC](https://www.ruby-forum.com/t/meta-http-equiv-refresh-content-5/148468/3 "2008-09-14T02:09:30Z")

</div>

What Christian means is something like:

Put this in your app/views/layouts/application.html.erb:

\<%= yield :refresh\_tag %\>

And then you will need to call this in a view:

\<% content\_for :refresh\_tag do %\>

> 

\<% end %\>

But this needs to be done in a view… unlike the requested  
before\_filter and after\_filter.

You could set a variable in the before filter and wrap the code in an  
if statement:

class ForumsController \< ApplicationController  
before\_filter :refresh, :only =\> :show

# …

private

def refresh  
@refresh = true  
end  
end

Then in your application.html.erb:

\<% if @refresh %\>

> 

\<% end %\>

* * *

Ryan B.  
Freelancer  
Skype: radarlistener  
MSN & Gtalk: removed\_email\_address@domain.invalid

On 14/09/2008, at 9:08 AM, Christian Rishøj wrote:
