2015-09-21 17:59:03 +02:00
|
|
|
class Procedure < ActiveRecord::Base
|
|
|
|
has_many :types_de_piece_justificative
|
2015-11-05 11:21:44 +01:00
|
|
|
has_many :types_de_champ
|
2015-09-21 17:59:03 +02:00
|
|
|
has_many :dossiers
|
2015-11-16 16:16:08 +01:00
|
|
|
accepts_nested_attributes_for :types_de_champ,:reject_if => proc { |attributes| attributes['libelle'].blank? }, :allow_destroy => true
|
2015-09-22 11:21:52 +02:00
|
|
|
|
2015-11-10 10:23:15 +01:00
|
|
|
belongs_to :administrateur
|
|
|
|
|
2015-09-22 11:21:52 +02:00
|
|
|
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
|
|
|
validates :description, presence: true, allow_blank: false, allow_nil: false
|
2015-11-17 15:30:03 +01:00
|
|
|
|
|
|
|
def types_de_champ_ordered
|
|
|
|
types_de_champ.order(:order_place)
|
|
|
|
end
|
2015-09-21 17:59:03 +02:00
|
|
|
end
|