Passing a parameter to a before_filter method


#1

I’ve got a couple of before_filter methods which are partially
redundant. I’d like to merge them into one and just look at a passed
parameter to tell which path to take. So instead of doing this…

before_filter :authorize
OR
before_filter :authorize_admin

I’d like to be able to do…

before_filter :authorize
OR
before_filter :authorize(“admin”)

So far, I haven’t been successful in doing this. Is this possible? Any
tips?

Thanks,
Alison


#2

Try

before_filter :authorize
before_filter lambda{ authorize(“admin”) }

But the second one might have some performance issues.

Kent.