2018-03-06 13:44:29 +01:00
|
|
|
class Entreprise < ApplicationRecord
|
2015-08-10 11:05:06 +02:00
|
|
|
belongs_to :dossier
|
2018-03-07 17:42:31 +01:00
|
|
|
has_one :etablissement
|
2016-06-20 13:57:57 +02:00
|
|
|
has_one :rna_information, dependent: :destroy
|
2016-08-02 14:45:09 +02:00
|
|
|
|
2018-03-06 13:44:29 +01:00
|
|
|
validates :siren, presence: true
|
|
|
|
validates :dossier_id, uniqueness: true
|
2016-08-30 11:18:43 +02:00
|
|
|
|
2018-03-07 17:42:02 +01:00
|
|
|
accepts_nested_attributes_for :rna_information, update_only: true
|
2018-02-22 16:53:29 +01:00
|
|
|
|
2016-08-30 11:18:43 +02:00
|
|
|
before_save :default_values
|
|
|
|
|
|
|
|
def default_values
|
|
|
|
self.raison_sociale ||= ''
|
|
|
|
end
|
2015-08-10 11:05:06 +02:00
|
|
|
end
|