add table Champs

This commit is contained in:
Xavier J 2015-11-03 10:48:40 +01:00
parent 2050465a75
commit 56eccf55df
10 changed files with 45 additions and 2 deletions

6
app/models/champs.rb Normal file
View file

@ -0,0 +1,6 @@
class Champs < ActiveRecord::Base
belongs_to :dossier
belongs_to :type_de_champs
delegate :libelle, :type_champs, :order_place, to: :type_de_champs
end

View file

@ -11,6 +11,7 @@ class Dossier < ActiveRecord::Base
has_one :entreprise, dependent: :destroy
has_one :cerfa, dependent: :destroy
has_many :pieces_justificatives, dependent: :destroy
has_many :champs, dependent: :destroy
belongs_to :procedure
belongs_to :user
has_many :commentaires, dependent: :destroy

View file

@ -5,7 +5,6 @@ class PieceJustificative < ActiveRecord::Base
alias_attribute :type, :type_de_piece_justificative_id
mount_uploader :content, PieceJustificativeUploader
def empty?
content.blank?
end

View file

@ -6,6 +6,7 @@ class TypeDeChamps < ActiveRecord::Base
}
belongs_to :procedure
has_many :champs
validates :libelle, presence: true, allow_blank: false, allow_nil: false
validates :type_champs, presence: true, allow_blank: false, allow_nil: false