lib/authority/controller.rb in authority-3.1.0 vs lib/authority/controller.rb in authority-3.2.0
- old
+ new
@@ -43,10 +43,14 @@
# ones and any other options applicable to a before_filter
def authorize_actions_for(resource_or_finder, options = {})
self.authority_resource = resource_or_finder
add_actions(options.fetch(:actions, {}))
force_action(options[:all_actions]) if options[:all_actions]
- before_filter :run_authorization_check, options
+ if respond_to? :before_action
+ before_action :run_authorization_check, options
+ else
+ before_filter :run_authorization_check, options
+ end
end
# Allows defining and overriding a controller's map of its actions to the model's authorizer methods
#
# @param [Hash] action_map - controller actions and methods, to be merged with existing action_map