If the parameter is static, then won’t the result be static too? If
so, you could just put in the result.
No, as a filter has access to other variables as well.
Another example would be:
before_filter :check_authentication(:user), :only => [:list, :show]
before_filter :check_authentication(:admin), :only => [:create, :delete]
(Sure, I could go with two separate functions
(check_admin_authentication and check_user_authentication) in this
particular example.)
I’m sure this feature is commonly needed, so it should be implemented in
Rails. I just don’t know how to use it.
Sorry if the syntax is not correct. I have used this kind of filter
before to pass parameters to methods. Note that if you need a filter
to make the user avaialbe then you need to call that filter before
this one.