lib/consul/controller.rb in consul-0.12.1 vs lib/consul/controller.rb in consul-0.12.2

- old
+ new

@@ -3,11 +3,15 @@ def self.included(base) base.send :include, InstanceMethods base.send :extend, ClassMethods if ensure_power_initializer_present? - base.before_filter :ensure_power_initializer_present + if Rails.version.to_i < 4 + base.before_filter :ensure_power_initializer_present + else + base.before_action :ensure_power_initializer_present + end end end private @@ -26,21 +30,33 @@ end private def require_power_check(options = {}) - before_filter :unchecked_power, options + if Rails.version.to_i < 4 + before_filter :unchecked_power, options + else + before_action :unchecked_power, options + end end # This is badly named, since it doesn't actually skip the :check_power filter def skip_power_check(options = {}) - skip_before_filter :unchecked_power, options + if Rails.version.to_i < 4 + skip_before_filter :unchecked_power, options + else + skip_before_action :unchecked_power, options + end end def current_power(&initializer) self.current_power_initializer = initializer - around_filter :with_current_power + if Rails.version.to_i < 4 + around_filter :with_current_power + else + around_action :with_current_power + end helper_method :current_power end def consul_guards @consul_guards ||= [] @@ -53,10 +69,14 @@ skip_power_check guard.filter_options # Store arguments for testing (@consul_power_args ||= []) << args - before_filter :check_power, guard.filter_options + if Rails.version.to_i < 4 + before_filter :check_power, guard.filter_options + else + before_action :check_power, guard.filter_options + end if guard.direct_access_method define_method guard.direct_access_method do guard.power_value(self, action_name) end