lib/consul/controller.rb in consul-0.12.4 vs lib/consul/controller.rb in consul-0.13.0
- old
+ new
@@ -44,9 +44,13 @@
if Rails.version.to_i < 4
skip_before_filter :unchecked_power, options
elsif Rails.version.to_i < 5
skip_before_action :unchecked_power, options
else
+ # Every `power` in a controller will skip the power check filter. After the 1st time, Rails 5+ will raise
+ # an error because there is no `unchecked_power` action to skip any more.
+ # To avoid this, we add the following extra option. Note that it must not be added in Rails 4 to avoid errors.
+ # See http://api.rubyonrails.org/classes/ActiveSupport/Callbacks/ClassMethods.html#method-i-skip_callback
skip_before_action :unchecked_power, { :raise => false }.merge!(options)
end
end
def current_power(&initializer)