lib/authority/controller.rb in authority-3.2.1 vs lib/authority/controller.rb in authority-3.2.2
- old
+ new
@@ -75,12 +75,18 @@
authority_actions(action_map)
end
# Convenience wrapper for instance method
def ensure_authorization_performed(options = {})
- after_filter(options.slice(:only, :except)) do |controller_instance|
- controller_instance.ensure_authorization_performed(options)
- end
+ if respond_to? :after_action
+ after_action(options.slice(:only, :except)) do |controller_instance|
+ controller_instance.ensure_authorization_performed(options)
+ end
+ else
+ after_filter(options.slice(:only, :except)) do |controller_instance|
+ controller_instance.ensure_authorization_performed(options)
+ end
+ end
end
# The controller action to authority action map used for determining
# which Rails actions map to which authority actions (ex: index to read)
#