# Find controller in Request

**URL:** <https://www.ruby-forum.com/t/find-controller-in-request/92138>\
**Category:** Rails\
**Created:** [April 16, 2007, 4:26pm UTC](https://www.ruby-forum.com/t/find-controller-in-request/92138 "2007-04-16T16:26:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 16, 2007, 4:26pm UTC](https://www.ruby-forum.com/t/find-controller-in-request/92138/1 "2007-04-16T16:26:54Z")

</div>

Hello all,

I have a get request, say [SuperDuper.com](http://www.superduper.com/football/list), which  
lists all footballs belonging to the company superduper. However, in  
the application controller, I want to create a filter which checks to  
see if there are any footballs in the database first and if not,  
forwards to a different URL.

Something like

if(request.url.controller == ‘football’)  
redirect\_to ‘some URL’

I have been looking around for this and cant find it.

Cheers,  
John

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 16, 2007, 5:58pm UTC](https://www.ruby-forum.com/t/find-controller-in-request/92138/2 "2007-04-16T17:58:06Z")

</div>

> I have been looking around for this and cant find it.

params[:controller] should be one way to access that datum.

- donald
