# Can FILTERS AND VERIFICATION functions take arguments?

**URL:** <https://www.ruby-forum.com/t/can-filters-and-verification-functions-take-arguments/113076>\
**Category:** Rails\
**Created:** [August 27, 2007, 9:50am UTC](https://www.ruby-forum.com/t/can-filters-and-verification-functions-take-arguments/113076 "2007-08-27T09:50:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ungsophy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/a5b964/32.png) [@ungsophy](https://www.ruby-forum.com/u/ungsophy)\
**Post date:** [August 27, 2007, 9:50am UTC](https://www.ruby-forum.com/t/can-filters-and-verification-functions-take-arguments/113076/1 "2007-08-27T09:50:51Z")

</div>

Hi,

I have some problems in using filter. My filter functions need to have  
arguments, but filter functions take only symbol that refer to  
function name. Consider the following code:

class BlogController \< ApplicationController

before\_filter :authorize

For instance, authorize need arguments. So how can I pass arguments to  
filter function?

Any helps always appreciate.

---

<div class="post-metadata">

**Author:** ![ungsophy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/a5b964/32.png) [@ungsophy](https://www.ruby-forum.com/u/ungsophy)\
**Post date:** [August 27, 2007, 10:11am UTC](https://www.ruby-forum.com/t/can-filters-and-verification-functions-take-arguments/113076/2 "2007-08-27T10:11:43Z")

</div>

Sophy Eung wrote:

> Hi,
> 
> I have some problems in using filter. My filter functions need to have  
> arguments, but filter functions take only symbol that refer to  
> function name. Consider the following code:
> 
> class BlogController \< ApplicationController
> 
> before\_filter :authorize
> 
> For instance, authorize need arguments. So how can I pass arguments to  
> filter function?
> 
> Any helps always appreciate.

what arguments does your filter need??

---

<div class="post-metadata">

**Author:** ![ungsophy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/a5b964/32.png) [@ungsophy](https://www.ruby-forum.com/u/ungsophy)\
**Post date:** [August 27, 2007, 10:48am UTC](https://www.ruby-forum.com/t/can-filters-and-verification-functions-take-arguments/113076/3 "2007-08-27T10:48:13Z")

</div>

removed\_email\_address@domain.invalid wrote:

> For instance, authorize need arguments. So how can I pass arguments to  
> filter function?

You can’t. It doesn’t really make sense to pass arguments to a filter.  
But your before\_filter can access the usual ActionController hashes  
(params, session, etc) which is where you would put stuff that may vary  
between requests.

–  
Cheers,

- Jacob A.
