demarches-normaliennes/app/models/entreprise.rb
2018-03-20 16:09:00 +01:00

16 lines
373 B
Ruby

class Entreprise < ApplicationRecord
belongs_to :dossier
has_one :etablissement
has_one :rna_information, dependent: :destroy
validates :siren, presence: true
validates :dossier_id, uniqueness: true
accepts_nested_attributes_for :rna_information, update_only: true
before_save :default_values
def default_values
self.raison_sociale ||= ''
end
end