diff --git a/app/controllers/admin/licenses_controller.rb b/app/controllers/admin/licenses_controller.rb index efd358000cd567429cf3ece16a0aafb3b1e7f6a7..966dab52d7f04bed4a75e2f64a5f3e6a3901325d 100644 --- a/app/controllers/admin/licenses_controller.rb +++ b/app/controllers/admin/licenses_controller.rb @@ -17,7 +17,7 @@ def new end def create - unless params[:license] + unless license_params.values_at(:data, :data_file).any?(&:present?) flash.now[:alert] = "No license was selected." @license = License.new @@ -63,8 +63,15 @@ def require_license end def license_params - license_params = params.require(:license).permit(:data_file, :data) - license_params.delete(:data) if license_params[:data_file] + license_params = params.require(:license).permit(:data) + + # Wiggle around StrongParameters because data_file is an ::UploadedFile + data_file = params[:license][:data_file] + if license_params.permitted? && data_file.present? + license_params.delete(:data) + license_params[:data_file] = data_file + end + license_params end end