Correct "return cant jump across threads" error when using check_authorization()

This commit is contained in:
Patrick Morgan 2011-09-14 13:39:11 -05:00 committed by Ryan Bates
parent 610d7e3ec4
commit b3fc5add34

View File

@ -247,9 +247,9 @@ module CanCan
#
def check_authorization(options = {})
self.after_filter(options.slice(:only, :except)) do |controller|
return if controller.instance_variable_defined?(:@_authorized)
return if options[:if] && !controller.send(options[:if])
return if options[:unless] && controller.send(options[:unless])
next if controller.instance_variable_defined?(:@_authorized)
next if options[:if] && !controller.send(options[:if])
next if options[:unless] && controller.send(options[:unless])
raise AuthorizationNotPerformed, "This action failed the check_authorization because it does not authorize_resource. Add skip_authorization_check to bypass this check."
end
end