Pass argument to method in filters?

how can i pass an argument to a method i’m passing to before_filter?

e.g.:
in application.rb:
def require_role(role)

end

in the controller:
before_filter :require_role ‘foo’???

is this possible?

According to the documentation at http://api.rubyonrails.org/

append_before_filter(*filters, &block)

The passed filters will be appended to the array of filters that’s run *
before* actions on this controller are performed.
So you can pass filters and an optional block also to the before_filter
method. I don’t know if what you are trying to do is possible but
passing in
a block to do your logic is possible.

aha - solved it:

before_filter { |controller| controller.require_role(‘some_role’) }

thanks for your help.

I found, I have to do:

before_filter(:only => :edit) { |controller|
controller.require_role(‘some_role’) }

Thanks to aha, it’s work well But I need the filter only for edit method
like:

before_filter :require_role(‘some_role’) :only => :edit

How can I do this?