forked from thesuss/shf-project
-
Notifications
You must be signed in to change notification settings - Fork 37
Model destroy actions for associated models
Patrick Bolger edited this page Jan 6, 2018
·
32 revisions
Model | Association | Considerations |
---|---|---|
ShfApplication | has_many, dependent: :destroy | |
User | has_many, through: :shf_applications | |
Payment | has_many, dependent: :destroy | User model does not currently destroy payments. Need an overall strategy for payment retention/destroy. Retain payment records? (perhaps via dependent: nullify). Or, archive payment records? Or, use HIPS as audit source as needed? (the HIPS record will contain user_id and payment_type, but not company ID) |
BusinessCategory | has_many, through: :shf_applications | |
Address | has_many, dependent: :destroy | |
Picture | has_many, dependent: :destroy |
Model | Association | Considerations |
---|---|---|
User | belongs_to | |
Company | belongs_to, optional |
Model | Association | Considerations |
---|---|---|
User | belongs_to | |
Company | belongs_to, optional | Company is destroyed in after_destroy callback if no remaining applications |
BusinessCategory | has_and_belongs_to_many | |
MemberAppWaitingReason | belongs_to | Should we destroy custom reasons when app is destroyed? |
UploadedFile | has_many | Uploaded files destroyed in before_destroy callback (confirm files are removed from file system) |