Can FILTERS AND VERIFICATION functions take arguments?

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.

ungsophy@gmail.com 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?

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.