Example:
def require_role(role)
#do some stuff with 'role' parameter
end
We can use it like this:
before_filter do |controller_instance|
controller_instance.require_role :admin
end
In fact, you can still use :only and :except if you need it, example:
before_filter :only => :index do |controller_instance|
controller_instance.require_role :admin
end
Have a nice day.
No comments:
Post a Comment