# Before\_filter question

**URL:** <https://www.ruby-forum.com/t/before-filter-question/79542>\
**Category:** Rails\
**Created:** [March 10, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/before-filter-question/79542 "2006-03-10T17:33:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [March 10, 2006, 5:33pm UTC](https://www.ruby-forum.com/t/before-filter-question/79542/1 "2006-03-10T17:33:24Z")

</div>

Let’s say I’m using before\_filter in my controller:

before\_filter :setup

def setup  
# do something here  
end

Is there any way my setup method can know which action is really about  
to be called? Let’s say I want to log out which action is going to be  
called, how can I know that in the before\_filter method? (My question  
is not really about logging, that’s just an example).

Thanks!  
Jeff

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [March 10, 2006, 5:45pm UTC](https://www.ruby-forum.com/t/before-filter-question/79542/2 "2006-03-10T17:45:45Z")

</div>

On 10 Mar 2006 16:30:58 -0000, Jeff C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> called, how can I know that in the before\_filter method? (My question  
> is not really about logging, that’s just an example).

logger.debug(“ACTION=” + action\_name)

You can find the docs for this here: [http://api.rubyonrails.org/](http://api.rubyonrails.org/)

Click on “ActionController::Base”. Scroll down to Attributes.

– James

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [March 10, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/before-filter-question/79542/3 "2006-03-10T18:10:31Z")

</div>

> You can find the docs for this here: [http://api.rubyonrails.org/](http://api.rubyonrails.org/)
> 
> Click on “ActionController::Base”. Scroll down to Attributes.

Thanks James. Sorry I missed that.

Jeff

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [March 10, 2006, 8:06pm UTC](https://www.ruby-forum.com/t/before-filter-question/79542/4 "2006-03-10T20:06:50Z")

</div>

On 10 Mar 2006 17:07:33 -0000, Jeff C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > You can find the docs for this here: [http://api.rubyonrails.org/](http://api.rubyonrails.org/)
> > 
> > Click on “ActionController::Base”. Scroll down to Attributes.
> 
> Thanks James. Sorry I missed that.

No need to apologize. I was just pointing out the docs, because  
there’s a lot of other useful attributes in there too.

– James
