Allow blank for lien_demarche

This commit is contained in:
Mathieu Magnin 2017-01-31 15:13:06 +01:00
parent 1bd66b6a9e
commit 8ba8135e6b
4 changed files with 11 additions and 4 deletions

View file

@ -6,8 +6,11 @@ class Admin::PiecesJustificativesController < AdminController
end
def update
@procedure.update_attributes(update_params)
flash.now.notice = 'Modifications sauvegardées'
if @procedure.update_attributes(update_params)
flash.now.notice = 'Modifications sauvegardées'
else
flash.now.notice = 'Une erreur est survenue'
end
render 'show', format: :js
end

View file

@ -5,5 +5,5 @@ class TypeDePieceJustificative < ActiveRecord::Base
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates_format_of :lien_demarche, with: URI::regexp
validates :lien_demarche, format: { with: URI::regexp }, allow_blank: true, allow_nil: true
end