Add Procedure#brouillon?

This commit is contained in:
gregoirenovel 2017-07-13 15:21:52 +02:00
parent 25800305ad
commit 36bee67085
3 changed files with 15 additions and 1 deletions

View file

@ -120,6 +120,10 @@ class Procedure < ActiveRecord::Base
return procedure if procedure.save
end
def brouillon?
published_at.nil?
end
def publish!(path)
self.update_attributes!({ published_at: Time.now, archived_at: nil })
ProcedurePath.create!(path: path, procedure: self, administrateur: self.administrateur)