Pass forward :if and :unless options to the before filter. i.e:

load_and_authorize_resource :if => condition == true
This commit is contained in:
Mauricio Zaffari
2012-02-02 21:06:38 -02:00
parent 9eebeb2155
commit 83e2dcebd0
2 changed files with 6 additions and 6 deletions

View File

@@ -6,8 +6,8 @@ module CanCan
options = args.extract_options!
resource_name = args.first
before_filter_method = options.delete(:prepend) ? :prepend_before_filter : :before_filter
controller_class.send(before_filter_method, options.slice(:only, :except)) do |controller|
controller.class.cancan_resource_class.new(controller, resource_name, options.except(:only, :except)).send(method)
controller_class.send(before_filter_method, options.slice(:only, :except, :if, :unless)) do |controller|
controller.class.cancan_resource_class.new(controller, resource_name, options.except(:only, :except, :if, :unless)).send(method)
end
end