lib/flipper/ui/actions/actors_gate.rb in flipper-ui-0.15.0 vs lib/flipper/ui/actions/actors_gate.rb in flipper-ui-0.16.0

- old
+ new

@@ -4,15 +4,16 @@ module Flipper module UI module Actions class ActorsGate < UI::Action - route %r{features/[^/]*/actors/?\Z} + include FeatureNameFromRoute + route %r{\A/features/(?<feature_name>.*)/actors/?\Z} + def get - feature_name = Rack::Utils.unescape(request.path.split('/')[-2]) - feature = flipper[feature_name.to_sym] + feature = flipper[feature_name] @feature = Decorators::Feature.new(feature) breadcrumb 'Home', '/' breadcrumb 'Features', '/features' breadcrumb @feature.key, "/features/#{@feature.key}" @@ -20,11 +21,10 @@ view_response :add_actor end def post - feature_name = Rack::Utils.unescape(request.path.split('/')[-2]) - feature = flipper[feature_name.to_sym] + feature = flipper[feature_name] value = params['value'].to_s.strip if Util.blank?(value) error = Rack::Utils.escape("#{value.inspect} is not a valid actor value.") redirect_to("/features/#{feature.key}/actors?error=#{error}")