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.