I’d like to create a before_filter method in my application controller like this…
def check_role(role_name) unless logged_in_user.has_role? role_name flash[:notice] = 'Access to that area requires additional privileges.' redirect_to :back end end
However, it doesn’t look as though before filters can take parameters.
Is there a way to parameterize this call, or am I trying to drive a screw with a hammer?
You should be able to do this with a block: