Module: Arturo::FeatureParamsSupport::WithStrongParams

Defined in:
lib/arturo/feature_params_support.rb

Constant Summary collapse

PERMITTED_ATTRIBUTES =
[ :symbol, :deployment_percentage ]

Instance Method Summary collapse

Instance Method Details

#feature_paramsObject


21
22
23
24
25
# File 'lib/arturo/feature_params_support.rb', line 21

def feature_params
  if feature = params[:feature]
    feature.permit(PERMITTED_ATTRIBUTES)
  end
end

#features_paramsObject


27
28
29
30
31
32
33
# File 'lib/arturo/feature_params_support.rb', line 27

def features_params
  features = params[:features]
  features.each do |id, attributes|
    attributes = attributes.to_unsafe_h if attributes.respond_to?(:to_unsafe_h)
    features[id] = ActionController::Parameters.new(attributes).permit(*PERMITTED_ATTRIBUTES)
  end
end