def subscription_params
        optional_targets = (params[:subscription][:optional_targets] || {}).keys.select { |key| key.to_s.start_with?("subscribing_to_") }
        optional_targets.each do |optional_target_key|
          params[:subscription][:optional_targets][optional_target_key] = params[:subscription][:optional_targets][optional_target_key].to_boolean
        end
        params.require(:subscription).permit(:key, :subscribing, :subscribing_to_email, optional_targets: optional_targets)
      end
def subscription_params
        optional_targets = (params[:subscription][:optional_targets] || {}).keys.select { |key| key.to_s.start_with?("subscribing_to_") }
        optional_targets.each do |optional_target_key|
          params[:subscription][:optional_targets][optional_target_key] = params[:subscription][:optional_targets][optional_target_key].to_boolean
        end
        params.require(:subscription).permit(:key, :subscribing, :subscribing_to_email, optional_targets: optional_targets)
      end
Only allow a trusted parameter "white list" through.